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

pycdc error #486

Closed
mehedih4x opened this issue May 28, 2024 · 7 comments
Closed

pycdc error #486

mehedih4x opened this issue May 28, 2024 · 7 comments

Comments

@mehedih4x
Copy link

pycdc error(segmentation fault) but pycdas bytecode decompile successfully. why??

@greenozon
Copy link
Contributor

those are different apps
please provide more details of your failure case

@Levak
Copy link
Contributor

Levak commented Jun 27, 2024

I was also getting consistent segmentation faults when trying to decompile python 3.10 and 3.11. it's not surprising considering it's not fully if not at all supported yet.

Afair it was segfaulting trying to dereference an empty stack. Regardless, the decompiled code would be false even if the invalid access was protected by a check, since I'm pretty sure op was also trying to decompile python 3.9+

@tjemg
Copy link

tjemg commented Aug 6, 2024

I also get segmentation fault if I run the tests. However, these issues only occur for the Release build - in particular, turning on any optimization (i.e. at least -O1), results in segmentation fault with the checks:

...

*** class_NODE_BINARY: PASS (1)
/home/gasiba/Downloads/git/pycdc/tests/decompyle_test.sh: line 41: 56934 Segmentation fault      (core dumped) ./pycdc "$pyc" -o "$base.src.py" > "$base.err" 2>&1
*** test_exceptions: XFAIL (4)
/home/gasiba/Downloads/git/pycdc/tests/decompyle_test.sh: line 41: 56941 Segmentation fault      (core dumped) ./pycdc "$pyc" -o "$base.src.py" > "$base.err" 2>&1
*** chain_assignment: FAIL (2 of 2)
	chain_assignment.2.7.pyc


	chain_assignment.3.7.pyc

...

*** unicode_future: PASS (4)
/home/gasiba/Downloads/git/pycdc/tests/decompyle_test.sh: line 41: 57476 Segmentation fault      (core dumped) ./pycdc "$pyc" -o "$base.src.py" > "$base.err" 2>&1

...

*** lambdas_assignment: PASS (1)
/home/gasiba/Downloads/git/pycdc/tests/decompyle_test.sh: line 41: 58108 Segmentation fault      (core dumped) ./pycdc "$pyc" -o "$base.src.py" > "$base.err" 2>&1

@greenozon
Copy link
Contributor

Very interesting! what Linux distro do you run?
what python ver

@tjemg
Copy link

tjemg commented Aug 6, 2024

This problem first occurred when I was porting the software to FreeBSD (compilation with clang/clang++), and I reproduced the issue on Slackware 15 (fresh install from ISO). I can check if the same issue occurs on Devuan...

@tjemg
Copy link

tjemg commented Aug 6, 2024

OK, just checked it now - problem also happens in Devuan 5.0.1
Steps to reproduce

mkdir build
cd build
cmake -GNinja -DCMAKE_CXX_FLAGS="-O2" -DCMAKE_BUILD_TYPE=Release ..
ninja -v
ninja check.... Boom!

FreeBSD: python version 3.9.19
Slackware: python version 2.7.18 + python 3.9.10
Devuan: python version 3.11.2

Forgot to mention explicitly, if I turn optimization to -O0, and run the checks, all is fine!
So, my best guess it that there is some UB in the code, and this does not depend on the python version - these symptoms are a typical effect thereof (i.e. observable behavior differs between optimized and non-optimized code).

@zrax zrax closed this as completed in 48d1bfa Aug 6, 2024
@greenozon
Copy link
Contributor

Thanks for details!
I agree, that debug builds are successfully passing the test cases run...

image (2)

but release build (even wihtout -O2 flag did crash a couple of times with coredumps!

I'm using FreeBSD 14.1

BTW, the default shell in above OS is /bin/sh and it is not possible to run the tests,
also if you install bash it'll be put not into /bin/bash but intlo /usr/local/bin/bash...

@zrax is it OK to make shebang more generic and cover majoriyt of OSes?

#!/bin/bash
->
#!/usr/bin/env bash

here is a small PR if you agree
#506

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

4 participants