Skip to content

Commit

Permalink
Fix for issue 163
Browse files Browse the repository at this point in the history
  • Loading branch information
hoene committed Oct 3, 2021
1 parent af59f7a commit 890400e
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/hdf/dataobject.c
Expand Up @@ -500,14 +500,17 @@ static int readOHDRHeaderMessageDataLayout(struct READER *reader,
store = ftell(reader->fhd);
if (fseek(reader->fhd, data_address, SEEK_SET) < 0)
return errno; // LCOV_EXCL_LINE
if (!data->data) {
if (data_size > 0x10000000)
return MYSOFA_INVALID_FORMAT;
data->data_len = data_size;
data->data = calloc(1, data_size);
if (!data->data)
return MYSOFA_NO_MEMORY; // LCOV_EXCL_LINE
if (data->data) {
free(data->data);
data->data = NULL;
}
if (data_size > 0x10000000)
return MYSOFA_INVALID_FORMAT;
data->data_len = data_size;
data->data = calloc(1, data_size);
if (!data->data)
return MYSOFA_NO_MEMORY; // LCOV_EXCL_LINE

err = fread(data->data, 1, data_size, reader->fhd);
if (err != data_size)
return MYSOFA_READ_ERROR; // LCOV_EXCL_LINE
Expand Down

0 comments on commit 890400e

Please sign in to comment.