aboutsummaryrefslogtreecommitdiff
path: root/lib/gdi/picload.cpp
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2007-06-27 17:14:03 +0000
committerFelix Domke <tmbinc@elitedvb.net>2007-06-27 17:14:03 +0000
commit48df44f3224eb8b95d66829622f919462984ca7f (patch)
tree3e78fa8fdd594eed3cfee247418306ae32b1baa9 /lib/gdi/picload.cpp
parent2c333dec2921a4d9248a33e4be7bc075f930f859 (diff)
downloadenigma2-48df44f3224eb8b95d66829622f919462984ca7f.tar.gz
enigma2-48df44f3224eb8b95d66829622f919462984ca7f.zip
don't crash when PNGs are too large.
Diffstat (limited to 'lib/gdi/picload.cpp')
-rw-r--r--lib/gdi/picload.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/gdi/picload.cpp b/lib/gdi/picload.cpp
index e3cdc035..6a79d552 100644
--- a/lib/gdi/picload.cpp
+++ b/lib/gdi/picload.cpp
@@ -393,7 +393,16 @@ static int png_load(const char *filename, int *x, int *y)
eDebug("[PNG] Error processing");
return 0;
}
-
+
+ if (width * height > 1000000) // 1000x1000 or equiv.
+ {
+ eDebug("[png_load] image size is %d x %d, which is \"too large\".", width, height);
+ png_read_end(png_ptr, info_ptr);
+ png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
+ fclose(fh);
+ return 0;
+ }
+
pic_buffer = new unsigned char[width * height * 3];
*x=width;
*y=height;