mirror of
https://github.com/fltk/fltk.git
synced 2026-06-05 16:12:13 +08:00
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:
+4
-2
@@ -3,7 +3,7 @@
|
|||||||
//
|
//
|
||||||
// Pixmap drawing code for the Fast Light Tool Kit (FLTK).
|
// 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
|
// 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
|
// 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_Image *Fl_Pixmap::copy(int W, int H) {
|
||||||
Fl_Pixmap *new_image; // New pixmap
|
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...
|
// Optimize the simple copy where the width and height are the same...
|
||||||
if (W == w() && H == h()) {
|
if (W == w() && H == h()) {
|
||||||
// Make an exact copy of the image and return it...
|
// Make an exact copy of the image and return it...
|
||||||
|
|||||||
Reference in New Issue
Block a user