Skip to content
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

PyPy SIGSEGV on small program #4030

Closed
gitlab-importer opened this issue Nov 19, 2023 · 7 comments
Closed

PyPy SIGSEGV on small program #4030

gitlab-importer opened this issue Nov 19, 2023 · 7 comments

Comments

@gitlab-importer
Copy link

In Heptapod by @BarrensZeppelin on Nov 19, 2023, 18:27

Originally reported here: https://codeforces.com/blog/entry/122455

PyPy crashes with a segmentation fault when it runs the following program:

def main():
    k = 15
    m = 3
    
    for a in range(k + 1):
        for b in range(k + 1):
            for c in range(min(m, k) + 1):
                for d in range(min(m, k) + 1):
                    continue
    return

t = 1
for _ in range(t):
    main() 

PyPy version:

Python 3.10.13 (f1607341da97ff5a1e93430b6e8c4af0ad1aa019, Oct 02 2023, 19:25:21)
[PyPy 7.3.13 with GCC 13.2.1 20230801]
@gitlab-importer
Copy link
Author

In Heptapod by @bjorn-martinsson on Nov 19, 2023, 20:49

Here is a small example with the same issue

def f():
    m = 3
    for a in range(100):
        for b in range(m + 1):
            for c in range(m + 1):
                pass
f() 

Can also confirm it crashes for me on Windows using

Python 3.10.12 (af44d0b8114cb82c40a07bb9ee9c1ca8a1b3688c, Jun 15 2023, 15:42:22)
[PyPy 7.3.12 with MSC v.1929 64 bit (AMD64)]

but it does not segfault with

Python 3.7.10 (51efa818fd9b, Apr 04 2021, 12:09:32)
[PyPy 7.3.4 with MSC v.1927 64 bit (AMD64)]

@gitlab-importer
Copy link
Author

In Heptapod by @arigo on Nov 19, 2023, 23:49

I had a quick look in gdb: it's a clean NULL pointer dereference in
ExtendedShortPreambleBuilder_add_preamble_op. In the operation doing len(something.label_args), this field label_args is None.

@gitlab-importer
Copy link
Author

In Heptapod by @Yawn_Sean on Nov 20, 2023, 04:03

Thanks for your help (I'm the one who posted that codeforces blog)! And I finally logged into this website. Actually, I discovered the issue through this submission: https://atcoder.jp/contests/arc168/submissions/47760691

And using this version of Pypy, the code also segfaults:

Python 3.9.16 (feeb267ead3e6771d3f2f49b83e1894839f64fb7, Dec 29 2022, 14:45:38)
[PyPy 7.3.11 with MSC v.1929 64 bit (AMD64)] on win32

@gitlab-importer
Copy link
Author

In Heptapod by @cfbolz on Nov 28, 2023, 17:32

mentioned in commit 5e21dfecc2d4320580bfe3a19f37c0e5a214d356

@gitlab-importer
Copy link
Author

In Heptapod by @cfbolz on Nov 28, 2023, 17:32

mentioned in commit cb4b136ee2310a63036994ad726cab6d077422d3

@gitlab-importer
Copy link
Author

In Heptapod by @cfbolz on Nov 28, 2023, 17:33

the crash is fixed now. tomorrow's 3.9 nightly should contain the fix.

@cfbolz
Copy link
Member

cfbolz commented Jan 8, 2024

this is fixed

@cfbolz cfbolz closed this as completed Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants