You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if ((1 << 30) / s->img_x / s->img_n < s->img_y) returnstbi__err("too large", "Image too large to decode");
stb_image.h line 5121 checking size of a PNG image returns with the error "Image too large to decode", when it should not.
In my test case, the PNG is 8bpp, RGBA, 300 x 100 pixels.
I have step-debugged the code, img_x, img_y, img_n are correct (300, 100, 4 respectively).
The text was updated successfully, but these errors were encountered:
Hi! I'm trying to think about how this can happen -- are ints 16 bits on this platform, maybe? (1 << 30) / s->img_x / s->img_n here should evaluate to (1 << 30) / 300 / 4 == 894784, but if (1 << 30)'s truncated to 16 bits, then it would evaluate to 0. (The idea behind this check is that it tests whether x * y * n > 2^30 without risking integer overflow.)
stb_image being used on a STM32 ARM Cortex-M7 micro controller.
Firmware built using gcc.
stb/stb_image.h
Line 5121 in 013ac3b
stb_image.h line 5121 checking size of a PNG image returns with the error "Image too large to decode", when it should not.
In my test case, the PNG is 8bpp, RGBA, 300 x 100 pixels.
I have step-debugged the code, img_x, img_y, img_n are correct (300, 100, 4 respectively).
The text was updated successfully, but these errors were encountered: