History log of /php-src/ext/gd/tests/imagecreatefromstring.wbmp (Results 1 – 1 of 1)
Revision Date Author Comments
# 2d1c3825 14-Nov-2024 Christoph M. Becker

Simplify WBMP imagecreatefromstring() detection (GH-16782)

According to the WBMP specification[1], the first field (type) of a
WBMP is a multi-byte integer, but only type `0` is supporte

Simplify WBMP imagecreatefromstring() detection (GH-16782)

According to the WBMP specification[1], the first field (type) of a
WBMP is a multi-byte integer, but only type `0` is supported. Thus
there is no need to read a multi-byte integer. The second field (fix
header) is a single byte; reading a multi-byte integer is not really
wrong, since the fix header field is laid out in a way which allows it
to be treated as such, but the check whether the MBI is greater than
or equal to zero is pretty useless, because negative values could only
be returned if overflow occurs (MBIs are unsigned).

So the only useful assumption we can make is that the first byte is
zero; we let `gdImageCreateFromWBMPCtx()` figure out the rest.

[1] <https://www.wapforum.org/what/technical/SPEC-WAESpec-19990524.pdf> section 6

show more ...