-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segfault compiling a very large source file #93964
Comments
I replicated on 3.10, but not any of 3.8, 3.9, 3.11, 3.12 |
I got a segfault on this line in Line 6615 in 5e30ba1
Here, With this traceback (in 3.10):
|
I'm not 100% sure, but this might be enough to fix it: - if (a->a_lnotab_off + 2 >= len) {
+ if (a->a_lnotab_off >= len - 2) { |
Actually, it seems there are several issues here:
It's the third one that I believe is actually causing the issue in this case. |
On a pragmatic level, it may be more appropriate and performant to use JSON and load it with the |
This points to a problem with the line number table. The code example is "only" a million lines or so, yet the line number table is exceeding 2 billion bytes in size. What I suspect is happening is that line numbers are alternating from ~0 to ~1million and back. @pablogsal This might be a useful test case for location table encodings. |
Can someone confirm that this doesn't reproduce on 3.11? |
I can confirm: |
Is there anything left to do here? |
There's #94044 for 3.12, and we could backport some version to 3.11 as well. |
I thought 3.11 and 3.12 were not impacted by the bug. |
3.11 and 3.12 don't have the issue of segfaulting with any reproducer I know of, but they still lack appropriate integer overflow checks that would be theoretically desirable. |
We can close this issue? |
Please, reopen if we missed anything |
Bug report
A friend trying to package the Python library
samson
for the Arch User Repository encountered crashes while bytecode compiling. This was narrowed down to this file within that package (a copy, renamed with a.txt
instead of.py
suffix to bypass GitHub restrictions, is attached; it imports other modules from the original library, but still appears to trigger the bug when compiled on its own, probably because the bug occurs before the imports are reached).The file consists mostly of several very, very large dict and list literals.
The crash is a memory access violation, apparently an out-of-bounds write (I suspect into the output buffer), possibly the result of an off-by-one error. It is preceded by allocation of several Gbytes of memory, and occurs whether
-O
or-OO
is used, or if the module is imported from a REPL. A valgrind trace from a run on my machine is included below:Your environment
libc
1.2.3) and Arch Linux x86-64 (withglibc
2.35), respectivelyThe text was updated successfully, but these errors were encountered: