Fix for handling of invalid gifs, patch 1587754 Noel Byron.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42824 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -715,12 +715,12 @@ wxGIFErrorCode wxGIFDecoder::LoadGIF(wxInputStream& stream)
|
|||||||
{
|
{
|
||||||
while ((i = (unsigned char)stream.GetC()) != 0)
|
while ((i = (unsigned char)stream.GetC()) != 0)
|
||||||
{
|
{
|
||||||
stream.SeekI(i, wxFromCurrent);
|
if (stream.Eof() || (stream.LastRead() == 0))
|
||||||
if (stream.Eof())
|
|
||||||
{
|
{
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
stream.SeekI(i, wxFromCurrent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -846,6 +846,11 @@ wxGIFErrorCode wxGIFDecoder::LoadGIF(wxInputStream& stream)
|
|||||||
/* skip all data */
|
/* skip all data */
|
||||||
while ((i = (unsigned char)stream.GetC()) != 0)
|
while ((i = (unsigned char)stream.GetC()) != 0)
|
||||||
{
|
{
|
||||||
|
if (stream.Eof() || (stream.LastRead() == 0))
|
||||||
|
{
|
||||||
|
Destroy();
|
||||||
|
return wxGIF_INVFORMAT;
|
||||||
|
}
|
||||||
stream.SeekI(i, wxFromCurrent);
|
stream.SeekI(i, wxFromCurrent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -867,19 +872,24 @@ wxGIFErrorCode wxGIFDecoder::LoadGIF(wxInputStream& stream)
|
|||||||
wxFileOffset pos = stream.TellI();
|
wxFileOffset pos = stream.TellI();
|
||||||
wxFileOffset numBytes = 3 * local_ncolors;
|
wxFileOffset numBytes = 3 * local_ncolors;
|
||||||
stream.SeekI(numBytes, wxFromCurrent);
|
stream.SeekI(numBytes, wxFromCurrent);
|
||||||
if (stream.TellI() != (pos + numBytes))
|
|
||||||
{
|
|
||||||
Destroy();
|
|
||||||
return wxGIF_INVFORMAT;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initial code size */
|
/* initial code size */
|
||||||
(void) stream.GetC();
|
(void) stream.GetC();
|
||||||
|
if (stream.Eof() || (stream.LastRead() == 0))
|
||||||
|
{
|
||||||
|
Destroy();
|
||||||
|
return wxGIF_INVFORMAT;
|
||||||
|
}
|
||||||
|
|
||||||
/* skip all data */
|
/* skip all data */
|
||||||
while ((i = (unsigned char)stream.GetC()) != 0)
|
while ((i = (unsigned char)stream.GetC()) != 0)
|
||||||
{
|
{
|
||||||
|
if (stream.Eof() || (stream.LastRead() == 0))
|
||||||
|
{
|
||||||
|
Destroy();
|
||||||
|
return wxGIF_INVFORMAT;
|
||||||
|
}
|
||||||
stream.SeekI(i, wxFromCurrent);
|
stream.SeekI(i, wxFromCurrent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user