Fix out-of-bounds read in invalid compressed X file

pull/450/head
Turo Lamminen 2015-01-28 14:29:14 +02:00
parent 95ad827277
commit f971b66c47
1 changed files with 4 additions and 0 deletions

View File

@ -214,6 +214,10 @@ XFileParser::XFileParser( const std::vector<char>& pBuffer)
AI_SWAP2(ofs);
P += 4;
if (P + ofs > End + 2) {
throw DeadlyImportError("X: Unexpected EOF in compressed chunk");
}
// push data to the stream
stream.next_in = (Bytef*)P;
stream.avail_in = ofs;