Check for having valid image size in wxGIFHandler saving code.
At least the width must be non-0 as we allocate a width-sized array below and 0 height is probably problematic -- and definitely not useful -- as well, so just bail out if either of them is 0.
This commit is contained in:
@@ -218,6 +218,8 @@ bool wxGIFHandler::DoSaveFile(const wxImage& image, wxOutputStream *stream,
|
|||||||
|
|
||||||
int width = image.GetWidth();
|
int width = image.GetWidth();
|
||||||
int height = image.GetHeight();
|
int height = image.GetHeight();
|
||||||
|
wxCHECK_MSG( width && height, false, wxS("can't save 0-sized file") );
|
||||||
|
|
||||||
int width_even = width + ((width % 2) ? 1 : 0);
|
int width_even = width + ((width % 2) ? 1 : 0);
|
||||||
|
|
||||||
if (first)
|
if (first)
|
||||||
|
|||||||
Reference in New Issue
Block a user