By cherry picking unmerged fix in upstream https://github.com/nothings/stb/issues/1745.
This commit is contained in:
Jeroen van Rijn
2025-11-05 09:15:49 +01:00
parent 12d8572d43
commit 4f370f66bb

View File

@@ -1401,7 +1401,11 @@ static int set_file_offset(stb_vorbis *f, unsigned int loc)
#endif
f->eof = 0;
if (USE_MEMORY(f)) {
if (f->stream_start + loc >= f->stream_end || f->stream_start + loc < f->stream_start) {
// Known problem upstream: https://github.com/nothings/stb/issues/1745
// But pull request hasn't been merged: https://github.com/nothings/stb/pull/1746
// So we cherry pick it.
// if (f->stream_start + loc >= f->stream_end || f->stream_start + loc < f->stream_start) {
if (loc >= f->stream_len) {
f->stream = f->stream_end;
f->eof = 1;
return 0;