Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on May 16, 2025. It is now read-only.
This repository was archived by the owner on May 16, 2025. It is now read-only.

Incorrect parsing of multi-line comments inside hex strings #57

@plusvic

Description

@plusvic

The parser is handling multi-line comments inside hex strings incorrectly. Let's use the following rule as an example:

rule TEST {
    strings:
      $ = {
            01 [5]    /* comment 1 */
            02        /* comment 2 */
      }
    condition:
      all of them
}

The rule is correct, but the parser is returning the following error:

unexpected RBRACE, expecting BYTE or MASKED_BYTE or LBRACKET or LPARENS

This is because the once the parser finds the opening /* for the first comment, it greedily consumes all the characters until the closing */ in the second comment. This causes the 02 byte to fall inside the comment, so the parser is actually seeing the string as: { 01 [5] }, which is syntactically invalid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions