summaryrefslogtreecommitdiff
path: root/src/Fl_BMP_Image.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/Fl_BMP_Image.cxx')
-rw-r--r--src/Fl_BMP_Image.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Fl_BMP_Image.cxx b/src/Fl_BMP_Image.cxx
index f9dd18b38..8542763be 100644
--- a/src/Fl_BMP_Image.cxx
+++ b/src/Fl_BMP_Image.cxx
@@ -27,6 +27,7 @@
#include <FL/Fl_BMP_Image.H>
#include <FL/fl_utf8.h>
+#include <FL/Fl.H>
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
@@ -187,6 +188,11 @@ Fl_BMP_Image::Fl_BMP_Image(const char *bmp) // I - File to read
d(bDepth);
if (offbits) fseek(fp, offbits, SEEK_SET);
+ if (((size_t)w()) * h() * d() > max_size() ) {
+ Fl::warning("BMP file \"%s\" is too large!\n", bmp);
+ fclose(fp);
+ return;
+ }
array = new uchar[w() * h() * d()];
alloc_array = 1;