python / python/cpython

test_initconfig_get_api fails on platforms where malloc(0) returns NULL

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

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

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

説明

Bug report

Bug description:

test_initconfig_get_api (Programs/_testembed.c) executes the code

    assert(PyInitConfig_GetStrList(config, "xoptions", &length, &items) == 0);
    assert(length == 0);

PyInitConfig_GetStrList has malloc

*items = malloc(list->length * sizeof(char*));

if length is zero the behavior of malloc(0) is implementation defined, this seems to be problematic on platforms where malloc of zero returns NULL.

CPython versions tested on:

3.14

Operating systems tested on:

Other

Linked PRs
  • gh-153816

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

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

はじめの一歩

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

調査の方向性

Programs/_testembed.c の test_initconfig_get_api から始め、長さゼロの xoptions リストに対する PyInitConfig_GetStrList の呼び出しを追跡します。malloc(0) が NULL を返すプラットフォームでの実装の割り当て動作を確認し、その後、期待される長さゼロを変更せずにテストが通ることを確認するため、対象のテストを実行します。

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

評価

技術スタック
c, python
領域
api, testing-qa
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
30/100

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

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