Fix segfault at ComputeNormMatch/normmatch.cpp:118 (issue 755)

git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@839 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
zdenop@gmail.com 2013-05-02 08:00:23 +00:00
parent 16aa99315a
commit 80040b834b
2 changed files with 5 additions and 1 deletions

View File

@ -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()

View File

@ -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 */