From d797bc18b4822098345d47212c4627f77173ae90 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Tue, 29 Jul 2014 12:27:07 -0400 Subject: [PATCH] Fix #3304. Fix crash in tostring_rgba_minimized when the region has zero-size. Thanks to @neothemachine for tracking this down. --- src/_backend_agg.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/_backend_agg.cpp b/src/_backend_agg.cpp index 416a3991f4ad..a392ce5c9f5e 100644 --- a/src/_backend_agg.cpp +++ b/src/_backend_agg.cpp @@ -2420,6 +2420,12 @@ RendererAgg::tostring_rgba_minimized(const Py::Tuple& args) *dst = src[y * width + x]; } } + } else { + data = PyBytes_FromStringAndSize(NULL, 0); + if (data == NULL) + { + throw Py::MemoryError("RendererAgg::tostring_minimized could not allocate memory"); + } } Py::Tuple bounds(4);