Skip to content

Commit

Permalink
Fix segfault at ComputeNormMatch/normmatch.cpp:118 (issue 755)
Browse files Browse the repository at this point in the history
git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@839 d0cd1f9f-072b-0410-8dd7-cf729c803f20
  • Loading branch information
zdenop@gmail.com committed May 2, 2013
1 parent 16aa993 commit 80040b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion classify/float2int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void Classify::ClearCharNormArray(uinT8* char_norm_array) {
* into char_norm_array. CharNormArray is indexed by unichar_id.
*
* Globals:
* - none
* - PreTrainedTemplates current set of built-in templates
*
* @param norm_feature character normalization feature
* @param[out] char_norm_array place to put results of size unicharset.size()
Expand Down
4 changes: 4 additions & 0 deletions classify/normmatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ FLOAT32 Classify::ComputeNormMatch(CLASS_ID ClassId,
PROTOTYPE *Proto;
int ProtoId;

if(ClassId > NormProtos->NumProtos) {
ClassId = NO_CLASS;
}

/* handle requests for classification as noise */
if (ClassId == NO_CLASS) {
/* kludge - clean up constants and make into control knobs later */
Expand Down

0 comments on commit 80040b8

Please sign in to comment.