X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b81e45065986abc34676fecc31515efeb3f3a8d4..12b5f4b4d2d8a07962da7ba3b78c8c1ec2634a67:/src/common/anidecod.cpp diff --git a/src/common/anidecod.cpp b/src/common/anidecod.cpp index bf5e22855a..8ff3071623 100644 --- a/src/common/anidecod.cpp +++ b/src/common/anidecod.cpp @@ -236,10 +236,12 @@ bool wxANIDecoder::Load( wxInputStream& stream ) m_info.Clear(); // we have a riff file: - while ( stream.IsOk() ) + while ( !stream.Eof() ) { // we always have a data size: - stream.Read(&datalen, 4); + if (!stream.Read(&datalen, 4)) + return false; + datalen = wxINT32_SWAP_ON_BE(datalen); //data should be padded to make even number of bytes @@ -248,7 +250,8 @@ bool wxANIDecoder::Load( wxInputStream& stream ) // now either data or a FCC: if ( (FCC1 == riff32) || (FCC1 == list32) ) { - stream.Read(&FCC2, 4); + if (!stream.Read(&FCC2, 4)) + return false; } else if ( FCC1 == anih32 ) { @@ -259,7 +262,8 @@ bool wxANIDecoder::Load( wxInputStream& stream ) return false; // already parsed an ani header? struct wxANIHeader header; - stream.Read(&header, sizeof(wxANIHeader)); + if (!stream.Read(&header, sizeof(wxANIHeader))) + return false; header.AdjustEndianness(); // we should have a global frame size @@ -284,7 +288,8 @@ bool wxANIDecoder::Load( wxInputStream& stream ) wxASSERT(m_info.GetCount() == m_nFrames); for (unsigned int i=0; i