python / python/cpython

plistlib inherits expat's newline-normalizing behavior, which can corrupt data in XML plists

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

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

stdlib type-bug
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

Bug report

Bug description:

This is just a special case of #84561 but it came up in the specific circumstance of XML plists in MOPUp, here: https://github.com/glyph/MOPUp/pull/448/files#r2280646662

I also discovered that it is possible to get the unmodified data, by changing plistlib._PlistParser.handle_data to look like this:

    def handle_data(self, data):
        ctx = self.parser.GetInputContext()
        if data == '\n' and ctx[0:1] != b'\n':
            data = ctx[0:1].decode("utf-8")
        self.data.append(data)

so we are not totally bound by the whims of Expat here; these types of bug could be fixed.

CPython versions tested on:

3.12, 3.13, 3.11

Operating systems tested on:

macOS

Linked PRs
  • gh-148305

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

調査の方向性

plistlib._PlistParser.handle_data と、報告書で説明されている入力コンテキストの動作から始めてください。XML plist データが現在どのように正規化されているかを確認し、変更されていないデータが保持されるようにしてください。開始前にリンクされた PR gh-148305 を確認してください。この作業はすでに進行中の可能性があります。

索引モデルが issue の本文から書いたものです。

評価

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

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

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