You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Restrict marshal.loads when magic is the same. This is more stringent than using the Python major/minor version
This commit is contained in:
@@ -31,7 +31,7 @@ from __future__ import print_function
|
|||||||
Probably a complete rewrite would be sensefull. hG/2000-12-27
|
Probably a complete rewrite would be sensefull. hG/2000-12-27
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import os, marshal, sys, types
|
import imp, os, marshal, sys, types
|
||||||
|
|
||||||
# set before importing scanner
|
# set before importing scanner
|
||||||
PYTHON3 = (sys.version_info >= (3, 0))
|
PYTHON3 = (sys.version_info >= (3, 0))
|
||||||
@@ -103,8 +103,9 @@ def load_module(filename):
|
|||||||
# print version
|
# print version
|
||||||
fp.read(4) # timestamp
|
fp.read(4) # timestamp
|
||||||
magic_int = magics.magic2int(magic)
|
magic_int = magics.magic2int(magic)
|
||||||
|
my_magic_int = magics.magic2int(imp.get_magic())
|
||||||
|
|
||||||
if version == PYTHON_VERSION:
|
if my_magic_int == magic_int:
|
||||||
# Note: a higher magic number necessarily mean a later
|
# Note: a higher magic number necessarily mean a later
|
||||||
# release. At Python 3.0 the magic number decreased
|
# release. At Python 3.0 the magic number decreased
|
||||||
# significantly. Hence the range below. Also note
|
# significantly. Hence the range below. Also note
|
||||||
|
Reference in New Issue
Block a user