From f0f253375415d500165ae59fe81d190f028bcd1c Mon Sep 17 00:00:00 2001 From: AnthoFoxo Date: Wed, 16 Dec 2020 18:19:03 -0500 Subject: [PATCH 1/4] closes #1063; Fixed files with no comments emitting outofmemory errors --- stb_vorbis.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stb_vorbis.c b/stb_vorbis.c index a8cbfa6..f32fdf6 100644 --- a/stb_vorbis.c +++ b/stb_vorbis.c @@ -3643,7 +3643,7 @@ static int start_decoder(vorb *f) //user comments f->comment_list_length = get32_packet(f); f->comment_list = (char**)setup_malloc(f, sizeof(char*) * (f->comment_list_length)); - if (f->comment_list == NULL) return error(f, VORBIS_outofmem); + if (f->comment_list == NULL && f->comment_list_length > 0) return error(f, VORBIS_outofmem); for(i=0; i < f->comment_list_length; ++i) { len = get32_packet(f); From b038c11bd5039c5c1acae1a8231ffd412fa2e9b3 Mon Sep 17 00:00:00 2001 From: AnthoFoxo Date: Wed, 16 Dec 2020 18:25:11 -0500 Subject: [PATCH 2/4] updated contributor list --- stb_vorbis.c | 1 + 1 file changed, 1 insertion(+) diff --git a/stb_vorbis.c b/stb_vorbis.c index f32fdf6..ab77bc0 100644 --- a/stb_vorbis.c +++ b/stb_vorbis.c @@ -33,6 +33,7 @@ // Timur Gagiev Maxwell Koo Peter Waller // github:audinowho Dougall Johnson David Reid // github:Clownacy Pedro J. Estebanez Remi Verschelde +// AnthoFoxo // // Partial history: // 1.20 - 2020-07-11 - several small fixes From 4882970b1c9be1c6b4d721fb18cec235093102e2 Mon Sep 17 00:00:00 2001 From: AnthoFoxo Date: Mon, 25 Jan 2021 20:01:42 -0500 Subject: [PATCH 3/4] vorbis comment list setup_malloc call is guarded --- stb_vorbis.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stb_vorbis.c b/stb_vorbis.c index ab77bc0..46f5370 100644 --- a/stb_vorbis.c +++ b/stb_vorbis.c @@ -3643,8 +3643,10 @@ static int start_decoder(vorb *f) f->vendor[len] = (char)'\0'; //user comments f->comment_list_length = get32_packet(f); - f->comment_list = (char**)setup_malloc(f, sizeof(char*) * (f->comment_list_length)); - if (f->comment_list == NULL && f->comment_list_length > 0) return error(f, VORBIS_outofmem); + f->comment_list = NULL; + if (f->comment_list_length > 0) + f->comment_list = (char**) setup_malloc(f, sizeof(char*) * (f->comment_list_length)); + if (f->comment_list == NULL) return error(f, VORBIS_outofmem); for(i=0; i < f->comment_list_length; ++i) { len = get32_packet(f); From b7b2aaa587977f19bc23c853371c72e4fdd8404c Mon Sep 17 00:00:00 2001 From: AnthoFoxo Date: Tue, 13 Apr 2021 09:43:41 -0400 Subject: [PATCH 4/4] fixed vorbis comments causing outofmem --- stb_vorbis.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stb_vorbis.c b/stb_vorbis.c index 46f5370..5dff95d 100644 --- a/stb_vorbis.c +++ b/stb_vorbis.c @@ -3645,8 +3645,10 @@ static int start_decoder(vorb *f) f->comment_list_length = get32_packet(f); f->comment_list = NULL; if (f->comment_list_length > 0) - f->comment_list = (char**) setup_malloc(f, sizeof(char*) * (f->comment_list_length)); - if (f->comment_list == NULL) return error(f, VORBIS_outofmem); + { + f->comment_list = (char**) setup_malloc(f, sizeof(char*) * (f->comment_list_length)); + if (f->comment_list == NULL) return error(f, VORBIS_outofmem); + } for(i=0; i < f->comment_list_length; ++i) { len = get32_packet(f);