Skip to content

Commit

Permalink
Convert assertion on (possibly corrupt) file contents to normal error…
Browse files Browse the repository at this point in the history
… check (HDFGroup#1861)

* Convert assertion on (possibly corrupt) file contents to normal error check

* Committing clang-format changes

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
jhendersonHDF and github-actions[bot] committed Aug 15, 2022
1 parent 63a773e commit bb1a489
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 10 additions & 1 deletion release_docs/RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,16 @@ Bug Fixes since HDF5-1.12.1 release
===================================
Library
-------
-
- Converted an assertion on (possibly corrupt) file contents to a normal
error check

Previously, the library contained an assertion check that a read superblock
doesn't contain a superblock extension message when the superblock
version < 2. When a corrupt HDF5 file is read, this assertion can be triggered
in debug builds of HDF5. In production builds, this situation could cause
either a library error or a crash, depending on the platform.

(JTH - 2022/07/08, HDFFV-11316, HDFFV-11317)


Java Library
Expand Down
4 changes: 3 additions & 1 deletion src/H5Fsuper.c
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,9 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
/* Sanity check - superblock extension should only be defined for
* superblock version >= 2.
*/
HDassert(sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_2);
if (sblock->super_vers < HDF5_SUPERBLOCK_VERSION_2)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL,
"invalid superblock - extension message should not be defined for version < 2")

/* Check for superblock extension being located "outside" the stored
* 'eoa' value, which can occur with the split/multi VFD.
Expand Down

0 comments on commit bb1a489

Please sign in to comment.