diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-07-07 11:46:39 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-07-07 11:47:02 +0200 |
commit | 24a01c0d396a77473cae1b85354cb3d1a03732cb (patch) | |
tree | b44e447dd982b1c6212675f7c60e56d0a42fff9b /thirdparty/misc | |
parent | 624eff4633bfb847a08e2354d57db429c51d0900 (diff) |
stb_vorbis: Add missing error checks in comment reading mallocs
Backported from https://github.com/nothings/stb/pull/989.
Fixes #40164.
Diffstat (limited to 'thirdparty/misc')
-rw-r--r-- | thirdparty/misc/stb_vorbis.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/thirdparty/misc/stb_vorbis.c b/thirdparty/misc/stb_vorbis.c index b0d79b1724..52c9c666a2 100644 --- a/thirdparty/misc/stb_vorbis.c +++ b/thirdparty/misc/stb_vorbis.c @@ -3630,6 +3630,7 @@ static int start_decoder(vorb *f) //file vendor len = get32_packet(f); f->vendor = (char*)setup_malloc(f, sizeof(char) * (len+1)); + if (f->vendor == NULL) return error(f, VORBIS_outofmem); for(i=0; i < len; ++i) { f->vendor[i] = get8_packet(f); } @@ -3637,10 +3638,12 @@ 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); for(i=0; i < f->comment_list_length; ++i) { len = get32_packet(f); f->comment_list[i] = (char*)setup_malloc(f, sizeof(char) * (len+1)); + if (f->comment_list[i] == NULL) return error(f, VORBIS_outofmem); for(j=0; j < len; ++j) { f->comment_list[i][j] = get8_packet(f); |