Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

load_module failing for Python 3.12.0 sample (magic_int 3531)

オープン
#185 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
43/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
python
領域
devtools

調査の方向性

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.8 and 6.3.0
  • Python version 3.14
  • OS: Microsoft Windows 11

Workarounds

Priority

Additional Context

主要言語
Python
スター
371
フォーク
106
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rocky/python-xdis のほかの issue

rocky/python-xdis の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。