From 2b6801eddbba92a6bd2a0235366c1d9c07011263 Mon Sep 17 00:00:00 2001 From: artem Date: Sun, 19 Jul 2015 21:54:26 +0200 Subject: [PATCH] Fix null pointer dereference when writing font name into HOCR. --- api/baseapi.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/baseapi.cpp b/api/baseapi.cpp index 59380e3917..546570909f 100644 --- a/api/baseapi.cpp +++ b/api/baseapi.cpp @@ -1490,8 +1490,10 @@ char* TessBaseAPI::GetHOCRText(int page_number) { hocr_str.add_str_int(" ", bottom); hocr_str.add_str_int("; x_wconf ", res_it->Confidence(RIL_WORD)); if (font_info) { - hocr_str += "; x_font "; - hocr_str += HOcrEscape(font_name); + if (font_name) { + hocr_str += "; x_font "; + hocr_str += HOcrEscape(font_name); + } hocr_str.add_str_int("; x_fsize ", pointsize); } hocr_str += "'";