Skip to content

Commit d797bc1

Browse files
committed
Fix #3304.
Fix crash in tostring_rgba_minimized when the region has zero-size. Thanks to @neothemachine for tracking this down.
1 parent 49bb323 commit d797bc1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/_backend_agg.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2420,6 +2420,12 @@ RendererAgg::tostring_rgba_minimized(const Py::Tuple& args)
24202420
*dst = src[y * width + x];
24212421
}
24222422
}
2423+
} else {
2424+
data = PyBytes_FromStringAndSize(NULL, 0);
2425+
if (data == NULL)
2426+
{
2427+
throw Py::MemoryError("RendererAgg::tostring_minimized could not allocate memory");
2428+
}
24232429
}
24242430

24252431
Py::Tuple bounds(4);

0 commit comments

Comments
 (0)