getimagesize(): WebP VP8 dimensions are accepted with an invalid start code

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

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

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

評価

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

調査の方向性

ext/standard/image.c:1147-1148 の VP8 寸法の非可逆デコードから始め、近くの画像解析コードがチャンクデータをどのように検証しているか確認してください。提供された getimagesizefromstring() のサンプルを使って回帰テストケースを追加し、関連する画像テストを実行してください。不正な開始コードが false を返し、有効な WebP の寸法が引き続き受け入れられれば完了です。

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

説明

Bug Status: Needs Triage
Description

The following code:

<?php
$webp = 'RIFF' . pack('V', 22) . 'WEBP'
      . 'VP8 ' . pack('V', 10)
      . "\x00\x00\x00"
      . "\x9d\x01\x2b"
      . "\xff\x3f\xff\x3f";
var_dump(getimagesizefromstring($webp));

Resulted in this output:

array(8) {
  [0]=>
  int(16383)
  [1]=>
  int(16383)
  [2]=>
  int(18)
  [3]=>
  string(28) "width="16383" height="16383""
  ["bits"]=>
  int(8)
  ["mime"]=>
  string(10) "image/webp"
  ["width_unit"]=>
  string(2) "px"
  ["height_unit"]=>
  string(2) "px"
}

But I expected this output instead:

bool(false)

ext/standard/image.c:1147-1148 decodes lossy VP8 dimensions without first validating the mandatory key-frame start code 9D 01 2A at buf[11..13]. A chunk containing the near-miss 9D 01 2B must be rejected rather than trusting arbitrary bytes at offsets 14-17 as dimensions.

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 を短くまとめたダイジェスト。