diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2002-10-11 13:54:10 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2002-10-11 13:54:10 +0000 |
| commit | fddb73a5f2cef20092927c37451e0d15c1d3d2a3 (patch) | |
| tree | fdee577a77d8382f5c2c415c679385a2c8b6742f /src | |
| parent | fe8518f37c9c0638e7f63ca4aa91e65c1c49ccc4 (diff) | |
Bug #621737: Add range checking for the width and height arguments to the
::copy() methods.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2671 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Bitmap.cxx | 5 | ||||
| -rw-r--r-- | src/Fl_Image.cxx | 5 | ||||
| -rw-r--r-- | src/Fl_Pixmap.cxx | 5 |
3 files changed, 9 insertions, 6 deletions
diff --git a/src/Fl_Bitmap.cxx b/src/Fl_Bitmap.cxx index 75cbfdf74..e246f6b92 100644 --- a/src/Fl_Bitmap.cxx +++ b/src/Fl_Bitmap.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.17 2002/08/09 01:09:48 easysw Exp $" +// "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.18 2002/10/11 13:54:10 easysw Exp $" // // Bitmap drawing routines for the Fast Light Tool Kit (FLTK). // @@ -407,6 +407,7 @@ void Fl_Bitmap::label(Fl_Menu_Item* m) { Fl_Image *Fl_Bitmap::copy(int W, int H) { // Optimize the simple copy where the width and height are the same... if (W == w() && H == h()) return new Fl_Bitmap(array, w(), h()); + if (W <= 0 || H <= 0) return 0; // OK, need to resize the image data; allocate memory and Fl_Bitmap *new_image; // New RGB image @@ -473,5 +474,5 @@ Fl_Image *Fl_Bitmap::copy(int W, int H) { // -// End of "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.17 2002/08/09 01:09:48 easysw Exp $". +// End of "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.18 2002/10/11 13:54:10 easysw Exp $". // diff --git a/src/Fl_Image.cxx b/src/Fl_Image.cxx index a30a0f98d..d58ecb28b 100644 --- a/src/Fl_Image.cxx +++ b/src/Fl_Image.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Image.cxx,v 1.5.2.3.2.23 2002/08/09 01:09:49 easysw Exp $" +// "$Id: Fl_Image.cxx,v 1.5.2.3.2.24 2002/10/11 13:54:10 easysw Exp $" // // Image drawing code for the Fast Light Tool Kit (FLTK). // @@ -142,6 +142,7 @@ Fl_Image *Fl_RGB_Image::copy(int W, int H) { !w() || !h() || !d() || !array) { return new Fl_RGB_Image(array, w(), h(), d(), ld()); } + if (W <= 0 || H <= 0) return 0; // OK, need to resize the image data; allocate memory and Fl_RGB_Image *new_image; // New RGB image @@ -391,5 +392,5 @@ void Fl_RGB_Image::label(Fl_Menu_Item* m) { // -// End of "$Id: Fl_Image.cxx,v 1.5.2.3.2.23 2002/08/09 01:09:49 easysw Exp $". +// End of "$Id: Fl_Image.cxx,v 1.5.2.3.2.24 2002/10/11 13:54:10 easysw Exp $". // diff --git a/src/Fl_Pixmap.cxx b/src/Fl_Pixmap.cxx index 2230ad9a4..fa61659c0 100644 --- a/src/Fl_Pixmap.cxx +++ b/src/Fl_Pixmap.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.21 2002/08/09 01:09:49 easysw Exp $" +// "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.22 2002/10/11 13:54:10 easysw Exp $" // // Pixmap drawing code for the Fast Light Tool Kit (FLTK). // @@ -223,6 +223,7 @@ void Fl_Pixmap::copy_data() { Fl_Image *Fl_Pixmap::copy(int W, int H) { // Optimize the simple copy where the width and height are the same... if (W == w() && H == h()) return new Fl_Pixmap(data()); + if (W <= 0 || H <= 0) return 0; // OK, need to resize the image data; allocate memory and Fl_Pixmap *new_image; // New pixmap @@ -460,5 +461,5 @@ void Fl_Pixmap::desaturate() { } // -// End of "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.21 2002/08/09 01:09:49 easysw Exp $". +// End of "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.22 2002/10/11 13:54:10 easysw Exp $". // |
