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
This commit is contained in:
Manolo Gouy 2018-01-16 06:21:16 +00:00
parent a000e12d6c
commit fab28479c7

View File

@ -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...