[php-src] PR #17356: Port "improve _gdImageFillTiled() internal function"
| From: | cmb69 | Date: | Sat, 04 Jan 2025 14:03:14 +0000 |
| Subject: | [php-src] PR #17356: Port "improve _gdImageFillTiled() internal function" | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-30236@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/17356
Author: cmb69
This improvement was done for libgd 2.1.0[1], and the erroneous calculation has been fixed as of
libgd 2.2.0[2].
While we're at it we also add the overflow checks of external libgd; these are not really
necessary, since
.sx * .sy overflow was already prevented when the image has been
created, and since we're using safe_emalloc() the struct seg overflow
is also prevented. It should be noted that overflow2() prevents int
overflow, while safe_emalloc() prevents size_t overflow, so the former is
more restrictive. For parity with external libgd, this still appears to be a good thing.
[1] <https://github.com/libgd/libgd/commit/86a5debede97ded92d644c3e06964c299e1e0810>
[2] <https://github.com/libgd/libgd/commit/e87ec88e1c4db664baf2c42e7fccf3f9dc53f0a6>