-Wstringop-overflow warning from gcc-14
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 15/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- c
- Domain
- audio-video-rtc
Research direction
The warning points at minimp3.h:695/697 inside L3_decode_scalefactors, inlined from L3_decode (1245) and mp3dec_decode_frame (1773), where iscf[40] is declared at line 662. First reproduce: compile a translation unit that includes minimp3.h with gcc-14 at the same optimisation level (the SDL_mixer build is a starting point) and check the reported offsets (up to 296) against the 40-byte buffer. Then trace how gr->n_long_sfb and i bound that index. Done means a decision backed by evidence: an index bound, or an explanation in the issue that the warning is a false positive.
Written by the indexing model from the issue text.
Description
In SDL_mixer, we are getting a -Wstringop-overflow warning from gcc-14:
https://github.com/libsdl-org/SDL_mixer/issues/616
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];
| ^~~~
Is it bogus, or should we take it seriously?
- Dominant language
- C
- Stars
- 2k
- Forks
- 271
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lieff/minimp3
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
[Bug]signed left-shift overflow in mp3dec_skip_id3v1 when parsing the APEv2 tag-size field (CWE-190)Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Integer overflow in Xing/Info VBR header parsing leads to ~10TB allocation (DoS)Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 Half a day Newbie friendliness 30/100
-
Difficulty 3/5 1-2 days Newbie friendliness 50/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
cyrusimap/cyrus-imapd#6640 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 60/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
GalusPeres/HomeTiles#139 · 1 comment ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
DaveGamble/cJSON#1122 ·
Maintainers usually reply within 12 days
-
Type: Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
apache/nuttx-apps#3942 ·
Maintainers usually reply within 1 day