From bdb7b832ae4a1a4a3141ff244ba01ef69c84636d Mon Sep 17 00:00:00 2001 From: buliabyak Date: Sat, 24 Feb 2007 17:32:52 +0000 Subject: [PATCH] fix crash when tracing with too small clones --- src/dialogs/clonetiler.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp index 968794754..e063c8054 100644 --- a/src/dialogs/clonetiler.cpp +++ b/src/dialogs/clonetiler.cpp @@ -788,6 +788,10 @@ clonetiler_trace_pick (NR::Rect box) guchar *px = g_new(guchar, 4 * width * height); memset(px, 0x00, 4 * width * height); + if (px == NULL) { + return 0; // buffer is too big or too small, cannot pick, so return 0 + } + /* Render */ NRPixBlock pb; nr_pixblock_setup_extern( &pb, NR_PIXBLOCK_MODE_R8G8B8A8N, -- 2.30.2