xmlrpc.client.loads raises IndexError on a malformed struct
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Bug description
xmlrpc.client.loads() raises a raw IndexError instead of xmlrpc.client.ResponseError when unmarshalling a <struct> that contains a <member> with a <name> but no <value>.
Unmarshaller.end_struct iterates the stacked items in pairs (items[i], items[i+1]). A <member> missing its <value> leaves an odd number of items, so items[i+1] raises IndexError.
The unmarshaller already raises ResponseError for sibling malformed cases (empty stack at line 640, unknown tag inside <data> at line 663).
Reproducer:
import xmlrpc.client
data = (b'<?xml version="1.0"?>'
b'<methodResponse><params><param><value>'
b'<struct><member><name>k</name></member></struct>'
b'</value></param></params></methodResponse>')
xmlrpc.client.loads(data)
# IndexError: list index out of range
Expected: xmlrpc.client.ResponseError.
CPython versions tested on
3.13, 3.14, 3.15, main
Operating systems tested on
macOS
Linked PRs
- gh-153805
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Unmarshaller.end_struct から始めます。ここで issue は IndexError を発生させるペア単位の反復処理を特定しているため、640 行目と 663 行目付近にある既存の不正な入力の処理と比較してください。reproducer が IndexError ではなく xmlrpc.client.ResponseError を発生させれば完了です。リンクされている PR gh-153805 は、その作業がすでに進行中であることを示しています。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- api
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 25/100