From 6b6d9de4979a2991f01dcc0f1da623bb9bfa77c2 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Fri, 30 Nov 2018 19:10:00 +0100 Subject: [PATCH] Fix potential crash in STRING class Signed-off-by: Stefan Weil --- src/ccutil/strngs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ccutil/strngs.cpp b/src/ccutil/strngs.cpp index 49562af402..cf5c1a80f8 100644 --- a/src/ccutil/strngs.cpp +++ b/src/ccutil/strngs.cpp @@ -195,7 +195,7 @@ int32_t STRING::length() const { const char* STRING::string() const { const STRING_HEADER* header = GetHeader(); - if (header->used_ == 0) + if (!header || header->used_ == 0) return nullptr; // mark header length unreliable because tesseract might