Skip to content

Commit b36c123

Browse files
bmriblerjhendersonHDF
authored andcommitted
An image size was corrupted and decoded as 0 resulting in a NULL image buffer, which caused a NULL pointer dereference when the image being copied to the buffer. The invalid image size was caught in the PR #5710. This change catches right before the copying. Fixes GH issue #5384
1 parent fb57086 commit b36c123

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/H5Centry.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,8 @@ H5C__load_entry(H5F_t *f,
10071007
/* Call the get_initial_load_size callback, to retrieve the initial size of image */
10081008
if (type->get_initial_load_size(udata, &len) < 0)
10091009
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "can't retrieve image size");
1010-
assert(len > 0);
1010+
if (len == 0)
1011+
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid size of image");
10111012

10121013
/* Check for possible speculative read off the end of the file */
10131014
if (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG)

0 commit comments

Comments
 (0)