[Scummvm-cvs-logs] SF.net SVN: scummvm:[55504] scummvm/trunk/engines/sword25/gfx/image/ pngloader.cpp
drmccoy at users.sourceforge.net
drmccoy at users.sourceforge.net
Mon Jan 24 15:59:22 CET 2011
Revision: 55504
http://scummvm.svn.sourceforge.net/scummvm/?rev=55504&view=rev
Author: drmccoy
Date: 2011-01-24 14:59:21 +0000 (Mon, 24 Jan 2011)
Log Message:
-----------
SWORD25: Fix some invalid writes / crashes
On my system, sizeof(png_uint_32) == 8, while sizeof(int) == 4.
Modified Paths:
--------------
scummvm/trunk/engines/sword25/gfx/image/pngloader.cpp
Modified: scummvm/trunk/engines/sword25/gfx/image/pngloader.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/image/pngloader.cpp 2011-01-24 14:10:15 UTC (rev 55503)
+++ scummvm/trunk/engines/sword25/gfx/image/pngloader.cpp 2011-01-24 14:59:21 UTC (rev 55504)
@@ -131,8 +131,12 @@
png_read_info(png_ptr, info_ptr);
// PNG Informationen auslesen
- png_get_IHDR(png_ptr, info_ptr, (png_uint_32 *)&width, (png_uint_32 *)&height, &bitDepth, &colorType, &interlaceType, NULL, NULL);
+ png_uint_32 w, h;
+ png_get_IHDR(png_ptr, info_ptr, &w, &h, &bitDepth, &colorType, &interlaceType, NULL, NULL);
+ width = w;
+ height = h;
+
// Pitch des Ausgabebildes berechnen
pitch = GraphicEngine::calcPitch(GraphicEngine::CF_ARGB32, width);
@@ -163,7 +167,9 @@
// Nachdem die Transformationen registriert wurden, werden die Bilddaten erneut eingelesen
png_read_update_info(png_ptr, info_ptr);
- png_get_IHDR(png_ptr, info_ptr, (png_uint_32 *)&width, (png_uint_32 *)&height, &bitDepth, &colorType, NULL, NULL, NULL);
+ png_get_IHDR(png_ptr, info_ptr, &w, &h, &bitDepth, &colorType, NULL, NULL, NULL);
+ width = w;
+ height = h;
if (interlaceType == PNG_INTERLACE_NONE) {
// PNGs without interlacing can simply be read row by row.
@@ -235,8 +241,12 @@
// PNG Informationen auslesen
int bitDepth;
int colorType;
- png_get_IHDR(png_ptr, info_ptr, (png_uint_32 *)&width, (png_uint_32 *)&height, &bitDepth, &colorType, NULL, NULL, NULL);
+ png_uint_32 w, h;
+ png_get_IHDR(png_ptr, info_ptr, &w, &h, &bitDepth, &colorType, NULL, NULL, NULL);
+ width = w;
+ height = h;
+
// Die Strukturen freigeben
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list