Closed mehedih4x closed 1 month ago
those are different apps please provide more details of your failure case
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+
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
Very interesting! what Linux distro do you run? what python ver
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...
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).
Thanks for details! I agree, that debug builds are successfully passing the test cases run...
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?
->
here is a small PR if you agree https://github.com/zrax/pycdc/pull/506
pycdc error(segmentation fault) but pycdas bytecode decompile successfully. why??