Skip to content

Conversation

@simon-paris
Copy link

This fixes a crash in parsing sequences of comments like the following:

//
/*
*/

The conditions to trigger the crash are:

  1. alternateCommentMode is set to true
  2. A single line comment is immediately followed by a block comment
  3. The block comment spans at least two lines

The crash happens because isDoubleSlashCommentLine returns true for lines starting with /*. It only checks for one slash because in the first callsite, offset points to the second slash character and the character before it is guaranteed to also be a slash. But this is not true in the second callsite. The result is that it treats the line with /* as a single line comment.

@alexander-fenster alexander-fenster merged commit eaf9f0a into protobufjs:master Aug 21, 2023
@alexander-fenster
Copy link
Contributor

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants