diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-07-07 12:16:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-07 12:16:59 +0200 |
commit | d0e0a19e4daa88b91613d92b0520035a1c4f5e9a (patch) | |
tree | 1ecd1aaf764653a40b5774f0055f8d03a9f021d1 /thirdparty/misc | |
parent | bd3a468fc243d47f2e7e56386b82bed38536b60e (diff) | |
parent | 24a01c0d396a77473cae1b85354cb3d1a03732cb (diff) |
Merge pull request #40174 from akien-mga/stb_vorbis-fix-comment-oom-crash
stb_vorbis: Add missing error checks in comment reading mallocs
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); |