summaryrefslogtreecommitdiff
path: root/plugins/AdvaImg/src/FreeImage/PluginGIF.cpp
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2015-05-18 07:31:16 +0000
committerKirill Volinsky <mataes2007@gmail.com>2015-05-18 07:31:16 +0000
commit76b86227951fdb5096572c36a256f07aee76def3 (patch)
tree713dcf30179d88b685605bdc8a03a5068832e4ff /plugins/AdvaImg/src/FreeImage/PluginGIF.cpp
parent4b289716d4cdd6b3ea29aec8d50e0b69afdc8384 (diff)
git-svn-id: http://svn.miranda-ng.org/main/trunk@13671 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AdvaImg/src/FreeImage/PluginGIF.cpp')
-rw-r--r--plugins/AdvaImg/src/FreeImage/PluginGIF.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/plugins/AdvaImg/src/FreeImage/PluginGIF.cpp b/plugins/AdvaImg/src/FreeImage/PluginGIF.cpp
index 87c0185865..0153959ab8 100644
--- a/plugins/AdvaImg/src/FreeImage/PluginGIF.cpp
+++ b/plugins/AdvaImg/src/FreeImage/PluginGIF.cpp
@@ -4,6 +4,7 @@
// Design and implementation by
// - Ryan Rubley <ryan@lostreality.org>
// - Raphaël Gaquer <raphael.gaquer@alcer.com>
+// - Aaron Shumate <aaron@shumate.us>
//
// This file is part of FreeImage 3
//
@@ -773,7 +774,11 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
}
if( info.disposal_method == GIF_DISPOSAL_BACKGROUND ) {
for( y = 0; y < info.height; y++ ) {
- scanline = (RGBQUAD *)FreeImage_GetScanLine(dib, logicalheight - (y + info.top) - 1) + info.left;
+ const int scanidx = logicalheight - (y + info.top) - 1;
+ if ( scanidx < 0 ) {
+ break; // If data is corrupt, don't calculate in invalid scanline
+ }
+ scanline = (RGBQUAD *)FreeImage_GetScanLine(dib, scanidx) + info.left;
for( x = 0; x < info.width; x++ ) {
*scanline++ = background;
}
@@ -800,7 +805,11 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
}
//copy page data into logical buffer, with full alpha opaqueness
for( y = 0; y < info.height; y++ ) {
- scanline = (RGBQUAD *)FreeImage_GetScanLine(dib, logicalheight - (y + info.top) - 1) + info.left;
+ const int scanidx = logicalheight - (y + info.top) - 1;
+ if ( scanidx < 0 ) {
+ break; // If data is corrupt, don't calculate in invalid scanline
+ }
+ scanline = (RGBQUAD *)FreeImage_GetScanLine(dib, scanidx) + info.left;
BYTE *pageline = FreeImage_GetScanLine(pagedib, info.height - y - 1);
for( x = 0; x < info.width; x++ ) {
if( !have_transparent || *pageline != transparent_color ) {