| Summary: | logic bug in ogg and opus loop code | ||
|---|---|---|---|
| Product: | SDL_mixer | Reporter: | Ozkan Sezer <sezeroz> |
| Component: | misc | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | admin, mikeguy42 |
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | All | ||
Applied the patch as https://hg.libsdl.org/SDL_mixer/rev/5ad7d1e1ddaa Closing this. If you think that there are any mistakes, please drop a note here. Looks good to me. I think there may be an opportunity to clean this up further after the patch for 4905 is applied. (In reply to Michael Day from comment #2) > Looks good to me. I think there may be an opportunity > to clean this up further Patches are welcome > after the patch for 4905 is applied. Are you OK'ing #4905? (Didn't see any note from you in there.) |
There is the following difference between ogg/opus and flac loop code (second is flac): if (((music->loop_start >= 0) || (music->loop_end > 0)) && - ((music->loop_start < music->loop_end) || (music->loop_end == 0)) && + ((music->loop_start < music->loop_end) || (music->loop_end > 0)) && (music->loop_start < full_length) && (music->loop_end <= full_length)) { if (music->loop_start < 0) music->loop_start = 0; The ogg and opus code are from Vitaly Novichkov, the flac version is from Michael Day (adding them to CC list now.) Vitaly confirms that his is incorrect. I'll be applying the following patch shortly: diff --git a/src/codecs/music_ogg.c b/src/codecs/music_ogg.c --- a/src/codecs/music_ogg.c +++ b/src/codecs/music_ogg.c @@ -336,7 +336,7 @@ static void *OGG_CreateFromRW(SDL_RWops full_length = vorbis.ov_pcm_total(&music->vf, -1); if (((music->loop_start >= 0) || (music->loop_end > 0)) && - ((music->loop_start < music->loop_end) || (music->loop_end == 0)) && + ((music->loop_start < music->loop_end) || (music->loop_end > 0)) && (music->loop_start < full_length) && (music->loop_end <= full_length)) { if (music->loop_start < 0) music->loop_start = 0; diff --git a/src/codecs/music_opus.c b/src/codecs/music_opus.c --- a/src/codecs/music_opus.c +++ b/src/codecs/music_opus.c @@ -332,7 +332,7 @@ static void *OPUS_CreateFromRW(SDL_RWops full_length = opus.op_pcm_total(music->of, -1); if (((music->loop_start >= 0) || (music->loop_end > 0)) && - ((music->loop_start < music->loop_end) || (music->loop_end == 0)) && + ((music->loop_start < music->loop_end) || (music->loop_end > 0)) && (music->loop_start < full_length) && (music->loop_end <= full_length)) { if (music->loop_start < 0) music->loop_start = 0;