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:
Vadim Zeitlin
2015-05-24 01:42:41 +02:00
parent ec46f55266
commit a82dc09927

View File

@@ -218,6 +218,8 @@ bool wxGIFHandler::DoSaveFile(const wxImage& image, wxOutputStream *stream,
int width = image.GetWidth();
int height = image.GetHeight();
wxCHECK_MSG( width && height, false, wxS("can't save 0-sized file") );
int width_even = width + ((width % 2) ? 1 : 0);
if (first)