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

"Bad MAGIC!" #23

Closed
deathnoise opened this issue Oct 8, 2012 · 5 comments
Closed

"Bad MAGIC!" #23

deathnoise opened this issue Oct 8, 2012 · 5 comments

Comments

@deathnoise
Copy link

After I've compiled complete package (using Microsoft Visual Studio 2012), whenever I try to decompile or disassemble ANY python .pyc file (for example - any file located in "tests" directory) I'm getting as a result

Bad MAGIC!
Could not load file test_with.pyc

Is there any specific reason why it doesn't work?

thanks

@zrax
Copy link
Owner

zrax commented Oct 9, 2012

That message indicates that the magic number (first 4 bytes of the pyc file) wasn't recognized... Since the .pyc files included in the tests directory are known to work at least far enough to decode the magic number, I suspect something is odd about compilation with VS2012, but I haven't been able to reproduce it so far (I tried with the VS 2012 platform toolset in both x86 and x64 targets). Please verify that your .pyc files aren't corrupt, and provide more details on your configuration.

@raszpl
Copy link

raszpl commented Feb 8, 2013

Confirming

Compiled with VC++2008 Express

K:\Documents and Settings\Administrator\Desktop\wot\dec\pycdc\bin>pycdas.exe ..\tests\15_test_class.pyc
Bad MAGIC!
15_test_class.pyc (Python -1.-1)
<TYPE: 48>

K:\Documents and Settings\Administrator\Desktop\wot\dec\pycdc\bin>pycdas.exe ..\tests\15_test_expressions.pyc
Bad MAGIC!
15_test_expressions.pyc (Python -1.-1)
<TYPE: 48>

K:\Documents and Settings\Administrator\Desktop\wot\dec\pycdc\bin>pycdas.exe ..\tests\22_class_method.pyc
Bad MAGIC!
22_class_method.pyc (Python -1.-1)
<TYPE: 48>

K:\Documents and Settings\Administrator\Desktop\wot\dec\pycdc\bin>pycdas.exe ..\tests\26_if_elif_else.pyc
Bad MAGIC!
26_if_elif_else.pyc (Python -1.-1)
<TYPE: 48>

K:\Documents and Settings\Administrator\Desktop\wot\dec\pycdc\bin>pycdas.exe ..\tests\31_while_loops.pyc
Bad MAGIC!
31_while_loops.pyc (Python -1.-1)
<TYPE: 48>

@idigger
Copy link

idigger commented Feb 19, 2013

Compiled with vc++2008 Debug mode is ok,
Release mode getting Bad MAGIC!

@raszpl
Copy link

raszpl commented Feb 19, 2013

vc++2008 with Debug mode produced garbage .exe files for me (“Program is not a recognized executable”) :(

@zrax
Copy link
Owner

zrax commented Jun 30, 2013

It turns out that newer versions of VS will re-order the getByte() calls in Release mode, but not Debug mode. This is why I couldn't reproduce it before :(. I'm creating a fix now

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