Repository navigation
Conversation
|
|
||
| switch (format) { | ||
| case ' ': | ||
| if (buf[11] != 0x9d || buf[12] != 0x01 || buf[13] != 0x2a) { |
There was a problem hiding this comment.
VP8L below has the same gap: the chunk must start with the 0x2F signature byte at buf[8], which isn't checked. With this patch, a VP8L chunk whose signature byte is 0x00 still returns width 16384. Please check it too and add that case to the test.
|
Retargeted to master. I also added the VP8L 0x2F signature check at buf[8], with a test case for it. |
| var_dump(getimagesizefromstring($webp)); | ||
|
|
||
| $webp = 'RIFF' . pack('V', 17) . 'WEBP' | ||
| . 'VP8L' . pack('V', 5) |
There was a problem hiding this comment.
This chunk is too short to reach the new check: php_handle_webp() returns NULL when it can't read 18 bytes, so this case is false without the fix too. Padding it to 10 bytes ('VP8L' . pack('V', 10) plus five more \x00, RIFF size 22) makes it fail before the fix (width 16384) and pass after.
|
Padded the VP8L chunk to 10 bytes so the test reaches the signature check, pushed. The two red jobs failed in the apt and Windows build steps before any tests ran, so they don't look related. |
A lossy VP8 key frame starts with the
9D 01 2Astart code, butphp_handle_webp()read the width and height from bytes 14-17 without checking it. AnyVP8chunk was accepted and arbitrary bytes were returned as dimensions. The start code is now checked, andgetimagesize()returns false when it does not match.Fixes #25964