Fixed issue 1114

git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@1073 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
theraysmith@gmail.com 2014-04-24 00:46:11 +00:00
parent 0dd47a2fd5
commit e6e6c35ee1

View File

@ -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;
@ -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;
@ -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;