Skip to content

Commit

Permalink
Fix 0 byte write heap buffer overflow in start_decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
JarLob committed Oct 19, 2023
1 parent beebb24 commit 746d207
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions stb_vorbis.c
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,7 @@ static void *setup_malloc(vorb *f, int sz)
sz = (sz+7) & ~7; // round up to nearest 8 for alignment of future allocs.
f->setup_memory_required += sz;
if (f->alloc.alloc_buffer) {
if (sz == 0) return NULL;
void *p = (char *) f->alloc.alloc_buffer + f->setup_offset;
if (f->setup_offset + sz > f->temp_offset) return NULL;
f->setup_offset += sz;
Expand Down

0 comments on commit 746d207

Please sign in to comment.