From 9328f0e5d4061613514d31ce924b054b22e3c9e6 Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Tue, 19 May 2015 10:17:44 +0200 Subject: [PATCH] Fix potential null pointer dereference in ccmain/paragraphs.cpp. --- api/pdfrenderer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/pdfrenderer.cpp b/api/pdfrenderer.cpp index 4acd9897a5..4d20bb3aee 100644 --- a/api/pdfrenderer.cpp +++ b/api/pdfrenderer.cpp @@ -636,7 +636,11 @@ bool TessPDFRenderer::BeginDocumentHandler() { " /Length1 %ld\n" ">>\n" "stream\n", size, size); - if (n >= sizeof(buf)) return false; + if (n >= sizeof(buf)) + { + delete[] buffer; + return false; + } AppendString(buf); objsize = strlen(buf); AppendData(buffer, size);