Check that zlib initialized correctly in FBX parser
Check the return code of inflateInit() indicates success to avoid crashing later when zstream contains invalid data.pull/444/head
parent
1c60211a15
commit
380021e7c4
|
@ -549,7 +549,9 @@ void ReadBinaryDataArray(char type, uint32_t count, const char*& data, const cha
|
||||||
zstream.data_type = Z_BINARY;
|
zstream.data_type = Z_BINARY;
|
||||||
|
|
||||||
// http://hewgill.com/journal/entries/349-how-to-decompress-gzip-stream-with-zlib
|
// http://hewgill.com/journal/entries/349-how-to-decompress-gzip-stream-with-zlib
|
||||||
inflateInit(&zstream);
|
if(Z_OK != inflateInit(&zstream)) {
|
||||||
|
ParseError("failure initializing zlib");
|
||||||
|
}
|
||||||
|
|
||||||
zstream.next_in = reinterpret_cast<Bytef*>( const_cast<char*>(data) );
|
zstream.next_in = reinterpret_cast<Bytef*>( const_cast<char*>(data) );
|
||||||
zstream.avail_in = comp_len;
|
zstream.avail_in = comp_len;
|
||||||
|
|
Loading…
Reference in New Issue