Patterns with odd number of backslashes at their end are invalid.
What happens currently:
$ ./re -d '\' test | cat -v
Precalculated size: 20
0: rsplit 5 (3)
2: any
3: jmp 0 (-5)
5: save 0
7: char ^@
9: char t
11: char e
13: char s
15: char t
17: save 1
19: match
Bytes: 20, insts: 11
Note that the end NUL byte is what is actually escaped, and then compilecode() misses the end of string (a kind of a buffer overflow) and continue to compile the subject string...
After this fix:
$ ./re -ed pike 'a\' test
Precalculated size: -1
fatal error: Error in regexp
In python3:
...
sre_constants.error: bogus escape (end of line)
Patterns with odd number of backslashes at their end are invalid.
What happens currently:
Note that the end NUL byte is what is actually escaped, and then compilecode() misses the end of string (a kind of a buffer overflow) and continue to compile the subject string...
After this fix:
In python3: