Skip to content

Commit

Permalink
WERD_RES: Fix uninitialized member variable
Browse files Browse the repository at this point in the history
Credit to OSS-Fuzz which reported this issue:

    pageres.cpp:1143:7: runtime error: load of value 249, which is not a valid value for type 'bool'
	    #0 0x6ba560 in WERD_RES::Clear() tesseract/src/ccstruct/pageres.cpp:1143:7
	    #1 0x6b9fd1 in WERD_RES::operator=(WERD_RES const&) tesseract/src/ccstruct/pageres.cpp:193:3
	    #2 0x49a9ad in WERD_RES::WERD_RES(WERD_RES const&) tesseract/src/ccstruct/pageres.h:356:11

See https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13707.

Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Mar 24, 2019
1 parent afc099b commit f4f34a8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/ccstruct/pageres.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,8 @@ class WERD_RES : public ELIST_LINK {
// Deep copies everything except the ratings MATRIX.
// To get that use deep_copy below.
WERD_RES(const WERD_RES& source) : ELIST_LINK(source) {
// combination is used in function Clear which is called from operator=.
combination = false;
InitPointers();
*this = source; // see operator=
}
Expand Down

0 comments on commit f4f34a8

Please sign in to comment.