Fix potential null pointer dereference in ccmain/paragraphs.cpp.

This commit is contained in:
Zdenko Podobný 2015-05-22 21:17:33 +02:00
parent 05acff6253
commit d8a55d739d
2 changed files with 10 additions and 3 deletions

View File

@ -636,7 +636,11 @@ bool TessPDFRenderer::BeginDocumentHandler() {
" /Length1 %ld\n" " /Length1 %ld\n"
">>\n" ">>\n"
"stream\n", size, size); "stream\n", size, size);
if (n >= sizeof(buf)) return false; if (n >= sizeof(buf))
{
delete[] buffer;
return false;
}
AppendString(buf); AppendString(buf);
objsize = strlen(buf); objsize = strlen(buf);
AppendData(buffer, size); AppendData(buffer, size);

View File

@ -2400,8 +2400,11 @@ void InitializeTextAndBoxesPreRecognition(const MutableIterator &it,
} }
word_res = page_res_it.forward(); word_res = page_res_it.forward();
} while (page_res_it.row() == this_row); } while (page_res_it.row() == this_row);
info->lword_box = lword->word->bounding_box();
info->rword_box = rword->word->bounding_box(); if(lword)
info->lword_box = lword->word->bounding_box();
if(rword)
info->rword_box = rword->word->bounding_box();
} }