summaryrefslogtreecommitdiff
path: root/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h
diff options
context:
space:
mode:
authorRasmus Villemoes <ravi@prevas.dk>2025-05-13 10:40:30 +0200
committerTom Rini <trini@konsulko.com>2025-05-29 08:25:18 -0600
commit5d3f91d6a82386e94c3178721641608563560871 (patch)
treec8cb3bf9566a102251faa3455ef969add3721704 /arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h
parent457f19815c8f8b74c36d8cbef454a0b575ea7068 (diff)
slre: fix matching of escape sequence used inside character class
At the compile stage, the anyof() function clearly intends to handle escape sequences like \d (for digits) inside square brackets, since the logic emits a 0 byte followed by the code representing the character class (NONSPACE, SPACE or DIGIT). However, this is not handled in the corresponding match helper is_any_of(); it just naively loops over all the bytes in the ->data array emitted by anyof() and compares those directly to the current character. For example, this means that the string "\x11" (containing the single character with value 17) is matched by the regex "[#%\d]", because DIGIT happens to be 17. Fix that by recognizing a zero byte as indicating something special and act accordingly. In order not to repeat the "increment *ofs and return 1" in all places, put those two lines after a new match: label. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
Diffstat (limited to 'arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h')
0 files changed, 0 insertions, 0 deletions