[php-src] PR #17680: Fix MSVC C4267 warnings in gd.c
| From: | cmb69 | Date: | Mon, 03 Feb 2025 14:42:51 +0000 |
| Subject: | [php-src] PR #17680: Fix MSVC C4267 warnings in gd.c | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-30642@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/17680
Author: cmb69
These warnings are about conversion from
size_t to a smaller type[1], and in this case
because gdIOCtx works with int lengths. Two of these warnings are
harmless, and we resolve them by using size_t in the first place, and adding a cast
(plus an assertion), respectively.
The others actually hint at potential issues when reading image data with more than
INT_MAX bytes; we catch that upfront, and throw a ValueError and a
warning, respectively.
[1] <https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4267>