getimagesize(): WebP VP8 dimensions are accepted with an invalid start code
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
调研方向
从 ext/standard/image.c:1147-1148 中有损的 VP8 尺寸解码开始,检查附近的图像解析代码如何验证分块数据。使用提供的 getimagesizefromstring() 示例添加一个回归用例,然后运行相关的图像测试。无效的起始代码返回 false,同时有效的 WebP 尺寸仍被接受,即为完成。
由索引模型根据 Issue 内容生成。
描述
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 小时
- 30 天内合并 PR
- 111
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
php/php-src 的其他 Issue
-
Bug Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Bug Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
Bug Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
Bug Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
Bug Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
相似的 Issue
-
bug no-disc-needed
难度 2/5 1-3 小时 新手友好度 84/100
Jstar269/nakagawa-recomp#3421 ·
维护者通常 1 天内回复
-
research-radar
难度 1/5 1 小时以内 新手友好度 68/100
-
1 stb_image 2 bug w/ repro 5 merged-dev
难度 1/5 1 小时以内 新手友好度 83/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
-
needs-playtest
难度 2/5 1-3 小时 新手友好度 82/100
Life-Framework/Life-Framework#5533 ·
维护者通常 1 天内回复