stb_vorbis: Add missing error checks in comment reading mallocs
Fixes #988.
This commit is contained in:
parent
f54acd4e13
commit
c24de24aa8
@ -31,7 +31,7 @@
|
|||||||
// Phillip Bennefall Rohit Thiago Goulart
|
// Phillip Bennefall Rohit Thiago Goulart
|
||||||
// github:manxorist saga musix github:infatum
|
// github:manxorist saga musix github:infatum
|
||||||
// Timur Gagiev Maxwell Koo Peter Waller
|
// Timur Gagiev Maxwell Koo Peter Waller
|
||||||
// github:audinowho Dougall Johnson
|
// github:audinowho Dougall Johnson Rémi Verschelde
|
||||||
//
|
//
|
||||||
// Partial history:
|
// Partial history:
|
||||||
// 1.19 - 2020-02-05 - warnings
|
// 1.19 - 2020-02-05 - warnings
|
||||||
@ -3630,6 +3630,7 @@ static int start_decoder(vorb *f)
|
|||||||
//file vendor
|
//file vendor
|
||||||
len = get32_packet(f);
|
len = get32_packet(f);
|
||||||
f->vendor = (char*)setup_malloc(f, sizeof(char) * (len+1));
|
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) {
|
for(i=0; i < len; ++i) {
|
||||||
f->vendor[i] = get8_packet(f);
|
f->vendor[i] = get8_packet(f);
|
||||||
}
|
}
|
||||||
@ -3637,10 +3638,12 @@ static int start_decoder(vorb *f)
|
|||||||
//user comments
|
//user comments
|
||||||
f->comment_list_length = get32_packet(f);
|
f->comment_list_length = get32_packet(f);
|
||||||
f->comment_list = (char**)setup_malloc(f, sizeof(char*) * (f->comment_list_length));
|
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) {
|
for(i=0; i < f->comment_list_length; ++i) {
|
||||||
len = get32_packet(f);
|
len = get32_packet(f);
|
||||||
f->comment_list[i] = (char*)setup_malloc(f, sizeof(char) * (len+1));
|
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) {
|
for(j=0; j < len; ++j) {
|
||||||
f->comment_list[i][j] = get8_packet(f);
|
f->comment_list[i][j] = get8_packet(f);
|
||||||
|
Loading…
Reference in New Issue
Block a user