summaryrefslogtreecommitdiff
path: root/src/Fl_Pixmap.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2018-01-16 06:21:16 +0000
committerManolo Gouy <Manolo>2018-01-16 06:21:16 +0000
commitfab28479c7252938ab0afdc9ed8a5af6f06fc754 (patch)
tree5d9fbe2646110ddb9a27488df7700779ce168549 /src/Fl_Pixmap.cxx
parenta000e12d6c83ab88b1d1dd67f5ce1a1963b8a18a (diff)
Avoid crash in Fl_Pixmap::copy() when the source Fl_Pixmap contains bad pixmap data.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12635 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Pixmap.cxx')
-rw-r--r--src/Fl_Pixmap.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Fl_Pixmap.cxx b/src/Fl_Pixmap.cxx
index 04fc6312d..3086af36b 100644
--- a/src/Fl_Pixmap.cxx
+++ b/src/Fl_Pixmap.cxx
@@ -3,7 +3,7 @@
//
// Pixmap drawing code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2017 by Bill Spitzak and others.
+// Copyright 1998-2018 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -149,7 +149,9 @@ void Fl_Pixmap::copy_data() {
Fl_Image *Fl_Pixmap::copy(int W, int H) {
Fl_Pixmap *new_image; // New pixmap
-
+ if (!data()) { // happens with bad pixmap data
+ return new Fl_Pixmap((char *const*)0);
+ }
// Optimize the simple copy where the width and height are the same...
if (W == w() && H == h()) {
// Make an exact copy of the image and return it...