summaryrefslogtreecommitdiffhomepage
path: root/lexer.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-02-11 23:44:29 +0100
committerJo-Philipp Wich <jo@mein.io>2022-02-11 23:46:26 +0100
commita29bad9454edcc285f7f37410b6822affede44d1 (patch)
tree1f0f2255cc64bfcc84efeab0ed5ae07f4f589b24 /lexer.c
parent86f0662f891ac83f474a412b4271af996f1ea44e (diff)
compiler: fix patchlist corruption on switch statement syntax errors
When compiling a switch statement with duplicate `default` cases or a switch statement with syntax errors before the body block, two error handling cases were hit in the code that prematurely returned from the function without resetting the compiler's patchlist pointer away from the on-stack patchlist that had been set up for the switch statement. Upon processing a subsequent break or continue control statement, a realloc was performed on the then invalid patchlist contents, triggering a segmentation fault or libc assert. Solve this issue by not returning from the function but breaking the switch body parsing loop. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'lexer.c')
0 files changed, 0 insertions, 0 deletions