we-like-parsers / cpython

Here we work on integrating pegen into CPython; use branch 'pegen'
https://github.com/gvanrossum/pegen
Other
1 stars 0 forks source link

f-string parser: debug expression followed by a normal expression crashes #167

Closed isidentical closed 2 years ago

isidentical commented 2 years ago
f"test{1+1 = } test {2+2}"
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
unpack_top_level_joined_strs (p=p@entry=0x7ffff72b6080, 
    raw_expressions=raw_expressions@entry=0x555555a4b250) at Parser/pegen.c:2644
2644            if (expr->kind == JoinedStr_kind) {
(gdb) 
isidentical commented 2 years ago

It is probably due to out-of-bounds access happening here: https://github.com/we-like-parsers/cpython/blob/04ec02a2f04ca25b20e20be1dd7fe280d6e2a52e/Parser/pegen.c#L2714-L2716