image->SetMask(false);
#if wxUSE_PALETTE
- if (pal)
- {
- unsigned char r[256];
- unsigned char g[256];
- unsigned char b[256];
-
- for (i = 0; i < 256; i++)
- {
- r[i] = pal[3*i + 0];
- g[i] = pal[3*i + 1];
- b[i] = pal[3*i + 2];
- }
+ unsigned char r[256];
+ unsigned char g[256];
+ unsigned char b[256];
- image->SetPalette(wxPalette(256, r, g, b));
+ for (i = 0; i < 256; i++)
+ {
+ r[i] = pal[3*i + 0];
+ g[i] = pal[3*i + 1];
+ b[i] = pal[3*i + 2];
}
+
+ image->SetPalette(wxPalette(256, r, g, b));
#endif // wxUSE_PALETTE
/* copy image data */
m_screenw = buf[0] + 256 * buf[1];
m_screenh = buf[2] + 256 * buf[3];
- const int maxScreenSize = 4 << 10;
- if ((m_screenw <= 0) || (m_screenw > maxScreenSize) || (m_screenh <= 0) || (m_screenh > maxScreenSize))
+ if ((m_screenw == 0) || (m_screenh == 0))
{
return wxGIF_INVFORMAT;
}
pimg->w = buf[4] + 256 * buf[5];
pimg->h = buf[6] + 256 * buf[7];
- if (pimg->w == 0 || pimg->h == 0)
+ if ((pimg->w == 0) || (pimg->w > m_screenw) || (pimg->h == 0) || (pimg->h > m_screenh))
{
Destroy();
return wxGIF_INVFORMAT;
if ((buf[8] & 0x80) == 0x80)
{
ncolors = 2 << (buf[8] & 0x07);
- if (ncolors <= 0)
- {
- Destroy();
- return wxGIF_INVFORMAT;
- }
-
wxFileOffset pos = m_f->TellI();
wxFileOffset numBytes = 3 * ncolors;
m_f->SeekI(numBytes, wxFromCurrent);