aboutsummaryrefslogtreecommitdiff
path: root/graphics/decoders
diff options
context:
space:
mode:
authorJohannes Schickel2013-08-18 18:21:19 +0200
committerJohannes Schickel2013-09-16 19:54:19 +0200
commit4063de40705c2b21e092f2a275182b0f41070b15 (patch)
treed22fe54af0dea2b6f2cf0bcfd8e38cb0e1bfbbb5 /graphics/decoders
parent4809294b43e1c43957874bdfcdadfc299fd7ace4 (diff)
downloadscummvm-rg350-4063de40705c2b21e092f2a275182b0f41070b15.tar.gz
scummvm-rg350-4063de40705c2b21e092f2a275182b0f41070b15.tar.bz2
scummvm-rg350-4063de40705c2b21e092f2a275182b0f41070b15.zip
GRAPHICS: Add some paranoia asserts in JPEGDecoder.
Diffstat (limited to 'graphics/decoders')
-rw-r--r--graphics/decoders/jpeg.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/graphics/decoders/jpeg.cpp b/graphics/decoders/jpeg.cpp
index ba6292bbbd..c858884095 100644
--- a/graphics/decoders/jpeg.cpp
+++ b/graphics/decoders/jpeg.cpp
@@ -214,7 +214,9 @@ bool JPEGDecoder::loadStream(Common::SeekableReadStream &stream) {
}
// Allocate buffer for one scanline
+ assert(cinfo.output_components == 3);
JDIMENSION pitch = cinfo.output_width * cinfo.output_components;
+ assert(_surface.pitch >= pitch);
JSAMPARRAY buffer = (*cinfo.mem->alloc_sarray)((j_common_ptr)&cinfo, JPOOL_IMAGE, pitch, 1);
// Go through the image data scanline by scanline
@@ -246,7 +248,7 @@ bool JPEGDecoder::loadStream(Common::SeekableReadStream &stream) {
} break;
case kColorSpaceYUV:
- memcpy(dst, src, _surface.pitch);
+ memcpy(dst, src, pitch);
break;
}
}