Skip to content

Commit

Permalink
Fix potential null pointer dereference in ccmain/paragraphs.cpp.
Browse files Browse the repository at this point in the history
  • Loading branch information
zdenop committed May 22, 2015
1 parent 05acff6 commit d8a55d7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion api/pdfrenderer.cpp
Expand Up @@ -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);
Expand Down
7 changes: 5 additions & 2 deletions ccmain/paragraphs.cpp
Expand Up @@ -2400,8 +2400,11 @@ void InitializeTextAndBoxesPreRecognition(const MutableIterator &it,
}
word_res = page_res_it.forward();
} 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();
}


Expand Down

0 comments on commit d8a55d7

Please sign in to comment.