libsdl-org / SDL_mixer

An audio mixer that supports various file formats for Simple Directmedia Layer.
zlib License
430 stars 147 forks source link

-Wstringop-overflow from gcc-14 #616

Open sezero opened 5 months ago

sezero commented 5 months ago

As inlined below

In file included from /tmp/SDL_mixer/src/codecs/minimp3/minimp3_ex.h:10,
                 from /tmp/SDL_mixer/src/codecs/music_minimp3.c:29:
In function 'L3_decode_scalefactors',
    inlined from 'L3_decode' at /tmp/SDL_mixer/src/codecs/minimp3/minimp3.h:1245:9,
    inlined from 'mp3dec_decode_frame' at /tmp/SDL_mixer/src/codecs/minimp3/minimp3.h:1773:17:
/home/ozzie/2/SDL_mixer/src/codecs/minimp3/minimp3.h:695:42: warning: writing 2 bytes into a region of size 1 [-Wstringop-overflow=]
  695 |             iscf[gr->n_long_sfb + i + 0] += gr->subblock_gain[0] << sh;
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/SDL_mixer/src/codecs/minimp3/minimp3.h: In function 'mp3dec_decode_frame':
/tmp/SDL_mixer/src/codecs/minimp3/minimp3.h:662:26: note: at offset [39, 40] into destination object 'iscf' of size 40
  662 |     uint8_t scf_size[4], iscf[40];
      |                          ^~~~
In function 'L3_decode_scalefactors',
    inlined from 'L3_decode' at /tmp/SDL_mixer/src/codecs/minimp3/minimp3.h:1245:9,
    inlined from 'mp3dec_decode_frame' at /tmp/SDL_mixer/src/codecs/minimp3/minimp3.h:1773:17:
/tmp/SDL_mixer/src/codecs/minimp3/minimp3.h:697:42: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  697 |             iscf[gr->n_long_sfb + i + 2] += gr->subblock_gain[2] << sh;
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/SDL_mixer/src/codecs/minimp3/minimp3.h: In function 'mp3dec_decode_frame':
/tmp/SDL_mixer/src/codecs/minimp3/minimp3.h:662:26: note: at offset [41, 296] into destination object 'iscf' of size 40
  662 |     uint8_t scf_size[4], iscf[40];
      |                          ^~~~
sezero commented 5 months ago

Also reported to minimp3 mainstream as https://github.com/lieff/minimp3/issues/119