You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got an error where tree sitter query generation failed with weggli 0.2.4, and the cli kindly informed me this was a bug.
Let me explain what I wanted to accomplish, what my query was, and the output.
What I Wanted to Find, For Extra Context
I want to find anywhere an enum value whose name ends with '_COUNT' is compared against some variable in order to find places an attacker can supply a negative enum value and dodge a bounds check.
Here is some example vulnerable code:
enumOptionType {
Option_A,
Option_B,
Option_COUNT
};
boolOPTIONS[Option_Count];
voidset_option(enumOptionTypeoption_type_attacker_controlled, boolset_to) {
// If option_type_attacker_controlled is negative this check will pass leading to an oob writeif (option_type_attacker_controlled >= Option_COUNT) { abort(); }
OPTIONS[option_type_attacker_controlled] =set_to;
}
The Buggy Query
Here is a minimal reproduction of a weggli query I came up with:
I got an error where tree sitter query generation failed with weggli 0.2.4, and the cli kindly informed me this was a bug.
Let me explain what I wanted to accomplish, what my query was, and the output.
What I Wanted to Find, For Extra Context
I want to find anywhere an enum value whose name ends with '_COUNT' is compared against some variable in order to find places an attacker can supply a negative enum value and dodge a bounds check.
Here is some example vulnerable code:
The Buggy Query
Here is a minimal reproduction of a weggli query I came up with:
The Actual Query
Here is the full query I wanted:
weggli --cpp -u -R '$counted=\w*_COUNT' -C '{($var >= $counted); OR: ($var > $counted); OR: ($var < $counted); OR: ($var <= $counted); }' ./
The text was updated successfully, but these errors were encountered: