From 380021e7c4e6a9c69d0a380b539def637338ad82 Mon Sep 17 00:00:00 2001 From: Johnny Dickinson Date: Sat, 24 Jan 2015 00:00:35 -0500 Subject: [PATCH] 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. --- code/FBXParser.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/FBXParser.cpp b/code/FBXParser.cpp index 7559a380d..bdeb40a09 100644 --- a/code/FBXParser.cpp +++ b/code/FBXParser.cpp @@ -549,7 +549,9 @@ void ReadBinaryDataArray(char type, uint32_t count, const char*& data, const cha zstream.data_type = Z_BINARY; // 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( const_cast(data) ); zstream.avail_in = comp_len;