load_module failing for Python 3.12.0 sample (magic_int 3531)
还没有人认领这个 Issue。
评估
调研方向
Start by reproducing the failure with the attached sample through xdis.load_module in xdis/load.py. Read the traceback paths in xdis/unmarshal.py and xdis/unmarsh_rust.py, especially the code handling source_path. Done means the Python 3.14 sample loads under xdis 6.3.0 with output matching 6.1.8.
由索引模型根据 Issue 内容生成。
描述
Description
Using Python 3.14 on a Windows system, the attached sample (password "infected" - NOTE: This is malware and should be handled with care) can successfully be loaded using xdis==6.1.8 but throws an error with xdis==6.3.0.
7e257e269e08677d6abfbebce761d339.zip
How to Reproduce
from xdis import load_module
print(load_module("/pathtosample/7e257e269e08677d6abfbebce761d339"))
Output Given
For xdis==6.1.8:
((3, 12, 0), 0, 3531, <Code311 code object <module> at 0x1fc21885220, file <string>>, line 1, False, 0, None)
For xdis==6.3.0:
Traceback (most recent call last):
File "C:\Python\Python314\Lib\site-packages\xdis\load.py", line 349, in load_module_from_file_object
co = xdis.unmarshal.load_code(fp, magic_int, code_objects)
File "C:\Python\Python314\Lib\site-packages\xdis\unmarshal.py", line 826, in load_code
return um_gen.load()
~~~~~~~~~~~^^
File "C:\Python\Python314\Lib\site-packages\xdis\unmarshal.py", line 231, in load
return self.r_object()
~~~~~~~~~~~~~^^
File "C:\Python\Python314\Lib\site-packages\xdis\unmarshal.py", line 286, in r_object
return unmarshal_func(save_ref, bytes_for_s)
File "C:\Python\Python314\Lib\site-packages\xdis\unmarsh_rust.py", line 198, in t_code_rust
source_path = self.read_string(src_len, False)
File "C:\Python\Python314\Lib\site-packages\xdis\unmarsh_rust.py", line 304, in read_string
s = self.read_slice(n)
File "C:\Python\Python314\Lib\site-packages\xdis\unmarshal.py", line 211, in read_slice
return self.fp.read(n)
~~~~~~~~~~~~^^^
ValueError: read length must be non-negative or -1
Traceback (most recent call last):
File "C:\Python\Python314\Lib\site-packages\xdis\load.py", line 349, in load_module_from_file_object
co = xdis.unmarshal.load_code(fp, magic_int, code_objects)
File "C:\Python\Python314\Lib\site-packages\xdis\unmarshal.py", line 826, in load_code
return um_gen.load()
~~~~~~~~~~~^^
File "C:\Python\Python314\Lib\site-packages\xdis\unmarshal.py", line 231, in load
return self.r_object()
~~~~~~~~~~~~~^^
File "C:\Python\Python314\Lib\site-packages\xdis\unmarshal.py", line 286, in r_object
return unmarshal_func(save_ref, bytes_for_s)
File "C:\Python\Python314\Lib\site-packages\xdis\unmarsh_rust.py", line 198, in t_code_rust
source_path = self.read_string(src_len, False)
File "C:\Python\Python314\Lib\site-packages\xdis\unmarsh_rust.py", line 304, in read_string
s = self.read_slice(n)
File "C:\Python\Python314\Lib\site-packages\xdis\unmarshal.py", line 211, in read_slice
return self.fp.read(n)
~~~~~~~~~~~~^^^
ValueError: read length must be non-negative or -1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Scripts\xdis_info.py", line 44, in <module>
main()
~~~~^^
File "C:\Scripts\xdis_info.py", line 38, in main
print(load_module(args.sample))
~~~~~~~~~~~^^^^^^^^^^^^^
File "C:\Python\Python314\Lib\site-packages\xdis\load.py", line 199, in load_module
return load_module_from_file_object(
fp,
...<4 lines>...
save_file_offsets=save_file_offsets,
)
File "C:\Python\Python314\Lib\site-packages\xdis\load.py", line 360, in load_module_from_file_object
raise ImportError(f"Ill-formed bytecode file {filename}\n{kind}; {msg}")
ImportError: Ill-formed bytecode file 7e257e269e08677d6abfbebce761d339
<class 'ValueError'>; read length must be non-negative or -1
Expected behavior
For 6.3.0, expect to receive the same output as for 6.1.8
Environment
- xdis version: Tested using
6.1.8and6.3.0 - Python version 3.14
- OS: Microsoft Windows 11
Workarounds
Priority
Additional Context
- 主要语言
- Python
- 星标
- 371
- 派生
- 106
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
rocky/python-xdis 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 35/100
rocky/python-xdis#93 · 6 条评论 ·
-
Enhancement Volunteer wanted to fix
难度 5/5 一周以上 新手友好度 25/100
rocky/python-xdis#70 ·
-
难度 4/5 3-5 天 新手友好度 30/100
rocky/python-xdis#63 · 1 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 35/100
rocky/python-xdis#58 · 2 条评论 · 1 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 35/100
rocky/python-xdis#32 ·
查看 rocky/python-xdis 的全部 Issue
相似的 Issue
-
docs pydanty:is-working
难度 2/5 1-3 小时 新手友好度 75/100
pydantic/pydantic-ai#8863 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
run-llama/llama_index#23278 ·
维护者通常 2 天内回复
-
documentation from-review-extraction github-actions priority: low severity:nit
难度 1/5 1 小时以内 新手友好度 92/100
LearningCircuit/local-deep-research#6946 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
oracle/langchain-oracle#323 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
tenstorrent/tt-metal#58057 · 1 条评论 ·
维护者通常 1 天内回复