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
This commit is contained in:
Michael R Sweet 2002-10-11 13:54:10 +00:00
parent fe8518f37c
commit fddb73a5f2
4 changed files with 13 additions and 7 deletions

View File

@ -1,6 +1,9 @@
CHANGES IN FLTK 1.1.1 CHANGES IN FLTK 1.1.1
- The WIN32 port needed to handle WM_MOUSELEAVE events - Bug #621737: Fl_Bitmap::copy(), Fl_Pixmap::copy(), and
Fl_RGB_Image::copy() now range-check the new width and
height to make sure they are positive integers.
- Bug #621740: the WIN32 port needed to handle WM_MOUSELEAVE events
in order to avoid problems with tooltips. in order to avoid problems with tooltips.
- Fl_PNM_Image didn't set the "alloc" flag for the data, - Fl_PNM_Image didn't set the "alloc" flag for the data,
which could lead to a memory leak. which could lead to a memory leak.

View File

@ -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). // 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) { Fl_Image *Fl_Bitmap::copy(int W, int H) {
// 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()) return new Fl_Bitmap(array, w(), h()); 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 // OK, need to resize the image data; allocate memory and
Fl_Bitmap *new_image; // New RGB image 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 $".
// //

View File

@ -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). // 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) { !w() || !h() || !d() || !array) {
return new Fl_RGB_Image(array, w(), h(), d(), ld()); 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 // OK, need to resize the image data; allocate memory and
Fl_RGB_Image *new_image; // New RGB image 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 $".
// //

View File

@ -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). // 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) { Fl_Image *Fl_Pixmap::copy(int W, int H) {
// 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()) return new Fl_Pixmap(data()); 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 // OK, need to resize the image data; allocate memory and
Fl_Pixmap *new_image; // New pixmap 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 $".
// //