Commit Graph

136 Commits

Author SHA1 Message Date
Fabian Giesen
0d47d17002 stb_vorbis: Set error on open_memory with NULL data
"Unexpected EOF" seems like the closest match from the error
codes we have.

Fixes issue #1123.
2021-07-04 19:26:31 -07:00
Fabian Giesen
0def11ae17 stb_vorbis: Fix some unused variables.
Fixes issue #817.
2021-07-04 16:35:45 -07:00
Fabian Giesen
39a0641385 stb_vorbis: Clarify lifetime of pushdata *output buffers
Fixes issue #929.
2021-07-04 16:25:33 -07:00
Fabian Giesen
d5613c9511 stb_vorbis: A few UB fixes.
Fixes issue #1018.
2021-07-04 16:19:46 -07:00
Fabian Giesen
c817c9621e stb_vorbis: Add missing cast to uint to avoid UB
Fixes issue #574.
2021-07-04 16:12:32 -07:00
Fabian Giesen
e31da438e8 stb_vorbis: Fix unused parameter warnings.
Some parameters do not get used, or only when certain config
defines are set. Explicitly mark them as unused to make compilers
happy.

Fixes issue #396.
2021-07-04 16:08:30 -07:00
Fabian Giesen
904ecbfc37 stb_vorbis: Remove spurious assignment to val
This is definitely unnecessary, or at least I can't find anything
in the Vorbis spec that would indicate anything special happening
here.

Fixes issue #816.
2021-07-04 03:15:43 -07:00
Fabian Giesen
5300d55277 stb_vorbis: Include alloca.h on Sun targets
See PR #1006.
2021-07-04 03:00:17 -07:00
morlad (iLeitgeb)
6fe053614c stb_vorbis: Fix memory leak in stb_vorbis
When start_decoder() fails it may already have allocated memory
for .vendor and/or .comment_list. Call vorbis_deinit() to free
any allocated memory.

Fixes issue #1051.
2021-07-04 02:52:24 -07:00
Fabian Giesen
2e3a6e8222 stb_vorbis: Move asserts around a bit
Not an actual bug, it just looked wonky, but this code runs
with code lengths that are verified to be in range (<32) by
the length-reading code. Anyway.

Fixes issue #901.
2021-07-04 02:43:00 -07:00
Johannes Schultz
3f671b870f stb_vorbis: rename BUFFER_SIZE macro to STB_BUFFER_SIZE
Fixes issue #1076.
2021-07-04 02:31:31 -07:00
Sean Barrett
52ad6bd4c9 update stb_vorbis version 2021-07-02 06:56:34 -07:00
AnthoFoxo
b7b2aaa587 fixed vorbis comments causing outofmem 2021-04-13 09:43:41 -04:00
AnthoFoxo
4882970b1c vorbis comment list setup_malloc call is guarded 2021-01-25 20:01:42 -05:00
AnthoFoxo
b038c11bd5 updated contributor list 2020-12-16 18:25:11 -05:00
AnthoFoxo
f0f2533754 closes #1063; Fixed files with no comments emitting outofmemory errors 2020-12-16 18:19:03 -05:00
Sean Barrett
314d0a6f9a update version numbers 2020-07-13 04:36:03 -07:00
Sean Barrett
580fc1ab9b Merge branch 'stb_vorbis-fix-comment-read-oom' of https://github.com/akien-mga/stb into working 2020-07-13 04:15:48 -07:00
Sean Barrett
db2acff8b1 stb_vorbis: fix bug in computing end of temp alloc buffer if it's not a multiple of 8 2020-07-13 04:12:21 -07:00
Sean Barrett
a9df364a7c Merge branch 'fix_stb_vorbis_alignment' of https://github.com/RandomShaper/stb into working 2020-07-13 04:00:41 -07:00
Sean Barrett
58b2e1490d Merge branch 'fix_alloca' of https://github.com/Clownacy/stb into working 2020-07-13 03:33:18 -07:00
Sean Barrett
fb1cea02f8 tweak PR 2020-07-13 03:06:50 -07:00
Sean Barrett
add7adc3ea Merge branch 'patch-1' of https://github.com/vickit144/stb into working 2020-07-13 03:05:44 -07:00
Sean Barrett
6f7420a825 add credits for last few PR merges 2020-07-13 02:59:10 -07:00
Rémi Verschelde
c24de24aa8 stb_vorbis: Add missing error checks in comment reading mallocs
Fixes #988.
2020-07-07 11:41:18 +02:00
Pedro J. Estébanez
2d0faa4d26 stb_vorbis.c: Fix missing update to 64-bit alignment 2020-05-03 02:35:08 +02:00
Clownacy
d8df5e9974 Add myself to the list of contributors
The pull-request template says to do so.
2020-04-24 18:46:28 +01:00
Clownacy
47a3c4f5b5 stb_vorbis.c - Detect __NEWLIB__ for alloca.h
This is needed for `stb_vorbis.c` to compile for the Wii U using
devkitPro.

This should theoretically also fix compilation for the Nintendo
Switch, 3DS, and Wii (with devkitPro, that is) as they all also use
Newlib.

Newlib is also used by Cygwin:
https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=newlib/libc/include/alloca.h;h=5d36318914282280b353aed457e1b1f64947b584;hb=HEAD

And the Google Native Client:
https://chromium.googlesource.com/native_client/nacl-newlib/+/refs/heads/master/newlib/libc/include/alloca.h

As you can see from these links, these both provide `alloca.h` as
well, so it appears to be a safe guarantee that `alloca.h` is
available on Newlib.
2020-04-24 18:34:59 +01:00
wph612
2e78eb603b
Added debugging check on line 1604
I added the code assert(f->valid_bits >= n);  instead of removing if (f->valid_bits < 0) return 0; to improve code with checking and debugging instead.
2020-03-24 20:49:40 -04:00
wph612
fcd0a0bfaa
Remove if (f->valid_bits < 0) return 0; on line 1603
I propose to remove this line because  f->valid_bits will never be less than zero since, in the while loop, you're adding 8 to it. Therefore, it will always evaluate to false. This is to help remove redundant code.
2020-03-24 19:47:18 -04:00
David Reid
1d35dc8609 stb_vorbis: Fix macro redefinition warning on MinGW. 2020-02-15 07:23:22 +10:00
Sean Barrett
37b9b20fde update version numbers 2020-02-05 03:19:08 -08:00
Marco Lizza
41a6bb58d1 Other (pedantic) warnings for possible uninitialized variables. 2020-02-04 17:03:48 +01:00
Marco Lizza
43c6bd4e0e Fixing (pedantic) cast warnings. 2020-02-04 17:03:23 +01:00
Sean Barrett
2bb4a0accd Fix trailing whitespace 2020-02-02 11:30:27 -08:00
Sean Barrett
7a69424f15 update version numbers 2020-02-02 11:26:50 -08:00
Sean Barrett
d79349d0b7 stb_vorbis: update credits 2020-02-02 10:54:29 -08:00
Sean Barrett
95ce252305 Merge branch 'OggComment' of https://github.com/audinowho/stb into work2 2020-02-02 10:51:14 -08:00
Sean Barrett
aad77ec74e Merge branch 'issue-799' of https://github.com/pwaller/stb into work2 2020-02-02 10:04:39 -08:00
Sean Barrett
4067b6d28b Merge branch 'kc/fix-coverity-issues-1' of https://github.com/krcroft/stb into work2 2020-02-02 10:02:25 -08:00
Peter Waller
2f18c96cfb Pad allocations in setup_{,temp_}malloc for 8-byte alignment
4-byte alignment triggered warnings with clang and -fsanitize=undefined.

Fix #799.

Signed-off-by: Peter Waller <p@pwaller.net>
2020-01-02 10:48:47 +00:00
Kevin Croft
58e0c4438d
STB Vorbis: eliminate inaccessible branch
The eliminated code removes the (ch == 1) branch, which is scoped
within this if condition: `if (rtype == 2 && ch != 1)`, therefore
the (ch == 1) branch will never be taken.

Fixes #842.
2019-12-04 22:09:14 -08:00
Kevin Croft
3b491aa07c
STB Vorbis: prevent division by zero in decode_resign if ch == 0
In the call to decode_residue:
  decode_residue(f, residue_buffers, ch, n2, r, do_not_decode);

The channel count is previously intialized as zero and incremented
based on a for-loop (f->channels) plus a conditional,
if (map->chan[j].mux == i).  If this doesn't happen then 'ch'
remains zero.

Once inside decode_residue(..), the code has three branches based
on channel count: stereo (ch == 2), mono (ch == 1), and then the
exception if it's neither of those (simple 'else').  It's in here
where a zero-valued 'ch' can be used as the denominator in these
calculations:
    int c_inter = z % ch
    p_inter = z/ch;

Obviously this 'else' branch is meant for channel counts greater
than two an not for zero channels; so this change simply makes
that branch only valid if (ch > 2).
2019-12-04 22:09:13 -08:00
Dougall Johnson
da79a214ef stb_vorbis: improve fix for theoretical seek performance problem 2019-10-21 20:39:31 +11:00
Dougall Johnson
c3298670d0 stb_vorbis: fix a couple asserts that fail on invalid files 2019-10-21 15:37:04 +11:00
Dougall Johnson
057914d959 stb_vorbis: fix pushdata for files with audio packets in header pages
Fixes #259, #597
2019-10-20 14:42:28 +11:00
Dougall Johnson
7c4eb44a63 stb_vorbis: fix seeking in files with audio packets in header pages
Fixes #682, #580
2019-10-01 20:47:29 +10:00
Dougall Johnson
2abc5c6ced stb_vorbis: fix seek_to_sample_coarse failure near page end 2019-10-01 16:50:21 +10:00
Dougall Johnson
6ca87a9e0e stb_vorbis: fix theoretical seek performance problem 2019-10-01 16:36:41 +10:00
Audino
2a0cff1288 Add comment support to stb_vorbis 2019-09-12 16:51:44 -07:00