Stream filter line-length above UINT_MAX silently aliases

オープン 初心者向け
#25,955 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

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

評価

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

調査の方向性

Issueでは ext/standard/filters.c:1192 のオプション変換が示され、php_conv_get_uint_prop_ex() が挙げられています。その変換と quoted-printable ストリームフィルターのテストを読み、近くにあるオプション検証が範囲外の値をどのように報告するかを確認してください。行の長さ 4294967372 のテストを追加し、有効な値が引き続き機能する一方で、期待される RangeError が発生することを確認してください。

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

説明

Bug Status: Needs Triage
Description

The following code:

<?php
$s = tmpfile();
fwrite($s, str_repeat('A', 100));
rewind($s);
stream_filter_append($s, 'convert.quoted-printable-encode', STREAM_FILTER_READ, [
    'line-length' => 4294967372,
]);
$result = stream_get_contents($s);
var_dump(strlen($result), substr_count($result, "\r\n"));
fclose($s);

Resulted in this output:

int(103)
int(1)

But I expected this output instead:

RangeError: line-length 4294967372 is outside the uint32_t range

php_conv_get_uint_prop_ex() reads the option as a wide zend_ulong but casts it to unsigned int at ext/standard/filters.c:1192, discarding the high bits. Thus 2^32 + 76 silently becomes 76 and produces the same 103-byte, one-line-break result as the legal 76 configuration; an out-of-range value must be rejected instead.

PHP Version
PHP 8.7.0-dev (cli) (built: Nov 29 2026 03:42:09) (NTS)
Copyright © The PHP Group and Contributors
Zend Engine v4.7.0-dev, Copyright © Zend by Perforce
    with Zend OPcache v8.7.0-dev, Copyright ©, by Zend by Perforce
Operating System

Ubuntu 24.04.5 LTS

主要言語
C
スター
41.9k
フォーク
8.5k
平均マージ
2日 17時間
マージ済み PR(30日)
111

環境構築

はじめの一歩

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

php/php-src のほかの issue

php/php-src の issue をすべて見る

似ている issue

C の issue をもっと見る

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

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