Skip to content

Percentages allow non-integer types #253

@vojone

Description

@vojone

I noticed, that rules like:

rule bad_type_percentage {
        strings:
                $s = "test"
        condition:
                "test"% of them
}

Result in error:

error: rule "bad_type_percentage" in test.yar(5): wrong type "string" for % operator

But when I execute this python code:

import yaramod

y = yaramod.Yaramod()
yara_file = y.parse_string(r'''
rule bad_type_percentage {
        strings:
                $s = "test"
        condition:
                "test"% of them
}
''')

print(yara_file.text)

No exception is raised by yaramod. Shouldn't yaramod also test the data type of the expression before the percentage (%) operator?

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