libsdl-org / SDL_image

Image decoding for many popular formats for Simple Directmedia Layer.
zlib License
513 stars 174 forks source link

-Wstringop-overflow warning from gcc-14 #453

Closed sezero closed 1 month ago

sezero commented 1 month ago

As inlined below

In file included from /SDL_image/src/IMG_stb.c:58:
/SDL_image/src/stb_image.h: In function 'stbi__parse_png_file.constprop':
/SDL_image/src/stb_image.h:5323:56: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 5323 |                   for (k = 0; k < s->img_n; ++k) tc[k] = (stbi_uc)(stbi__get16be(s) & 255) * stbi__depth_scale_table[z->depth]; // non 8-bit images will be larger
      |                                                  ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/SDL_image/src/stb_image.h:5230:25: note: at offset 3 into destination object 'tc' of size 3
 5230 |    stbi_uc has_trans=0, tc[3]={0};
      |                         ^~
sezero commented 1 month ago

Others have reported the issue to mainstream already: https://github.com/nothings/stb/issues/1642

Should we close this as WONTFIX?