BMP width above INT_MAX is published as a negative HTML attribute
维护者通常 1 天内回复
评估
调研方向
先查看 ext/standard/image.c 第127行附近的 BMP 宽度解析,以及第1594行附近的共享格式化器;然后检查附近的图像尺寸测试,找到相关的测试文件。拒绝大于 INT_MAX 的 BMP 宽度,使 getimagesizefromstring() 对给定的格式错误图像返回 false,并运行针对性测试进行确认。
由索引模型根据 Issue 内容生成。
描述
Description
The following code:
<?php
$bmp = 'BM' . pack('VVV', 54, 0, 54)
. pack('VVV', 40, 0x80000001, 1)
. pack('vv', 1, 24)
. str_repeat("\0", 24);
var_dump(getimagesizefromstring($bmp));
Resulted in this output:
array(8) {
[0]=>
int(2147483649)
[1]=>
int(1)
[2]=>
int(6)
[3]=>
string(30) "width="-2147483647" height="1""
["bits"]=>
int(24)
["mime"]=>
string(9) "image/bmp"
["width_unit"]=>
string(2) "px"
["height_unit"]=>
string(2) "px"
}
But I expected this output instead:
bool(false)
ext/standard/image.c:127 assembles the signed BMP biWidth bytes directly into unsigned result->width without rejecting values above INT_MAX, and the shared formatter at image.c:1594 prints that unsigned value with %d. The malformed width must be rejected instead of being returned as 2147483649 and rendered as -2147483647.
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 天 16 小时
- 30 天内合并 PR
- 116
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
php/php-src 的其他 Issue
-
Bug Status: Needs Triage
难度 1/5 1 小时以内 新手友好度 74/100
维护者通常 1 天内回复
-
getimagesize(): WebP VP8 dimensions are accepted with an invalid start code可能已有人在做 @lazerg 今天认领。 未关闭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 小时 新手友好度 75/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
shinyquagsire23/OpenJKDF2#540 ·
维护者通常 12 天内回复
-
Prison work hall: laundry and kitchen stations stand at bare walls, the hatch has no counter or sign未关闭
难度 2/5 1-3 小时 新手友好度 78/100
Life-Framework/Life-Framework#5939 ·
维护者通常 1 天内回复
-
autoconf failes to find libsodium even when present due to implicit function declaration可能已有人在做 @coderjoe 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 13 天内回复
-
bug python
难度 2/5 1-3 小时 新手友好度 87/100
Jstar269/nakagawa-recomp#3521 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100