Skip to content

Commit

Permalink
Fixed issue 1114
Browse files Browse the repository at this point in the history
git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@1073 d0cd1f9f-072b-0410-8dd7-cf729c803f20
  • Loading branch information
theraysmith@gmail.com committed Apr 24, 2014
1 parent 0dd47a2 commit e6e6c35
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cube/char_samp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ CharSamp *CharSamp::FromCharDumpFile(CachedFile *fp) {
return NULL;
}
// the label is not null terminated in the file
if (val32 > 0) {
if (val32 > 0 && val32 < MAX_UINT32) {
label32 = new char_32[val32 + 1];
if (label32 == NULL) {
return NULL;
Expand Down Expand Up @@ -193,7 +193,7 @@ CharSamp *CharSamp::FromCharDumpFile(FILE *fp) {
return NULL;
}
// the label is not null terminated in the file
if (val32 > 0) {
if (val32 > 0 && val32 < MAX_UINT32) {
label32 = new char_32[val32 + 1];
if (label32 == NULL) {
return NULL;
Expand Down Expand Up @@ -592,7 +592,7 @@ CharSamp *CharSamp::FromCharDumpFile(unsigned char **raw_data_ptr) {
memcpy(&val32, raw_data, sizeof(val32));
raw_data += sizeof(val32);
// the label is not null terminated in the file
if (val32 > 0) {
if (val32 > 0 && val32 < MAX_UINT32) {
label32 = new char_32[val32 + 1];
if (label32 == NULL) {
return NULL;
Expand Down

0 comments on commit e6e6c35

Please sign in to comment.