Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for file format security issues #4283

Merged
merged 3 commits into from
Apr 1, 2024

Conversation

jhendersonHDF
Copy link
Collaborator

Addresses file format security issues detected via fuzzing.

Credit: Amazon Web Services and @qkoziol

@jhendersonHDF jhendersonHDF added Merge - To 1.14 Priority - 0. Blocker ⛔ This MUST be merged for the release to happen Component - C Library Core C library issues (usually in the src directory) Component - Tools Command-line tools like h5dump, includes high-level tools Type - Bug / Bugfix Please report security issues to [email protected] instead of creating an issue on GitHub labels Mar 29, 2024
*-------------------------------------------------------------------------
*/
bool
H5T_noop_conv(const H5T_t *src, const H5T_t *dst)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in this file mostly come from merging my cleanup with the same cleanup from @qkoziol. This appears to be the main change that was in this file.

@@ -589,12 +589,12 @@ dump_table(hid_t fid, char *tablename, table_t *table)

PRINTSTREAM(rawoutstream, "%s: # of entries = %d\n", tablename, table->nobjs);
for (u = 0; u < table->nobjs; u++) {
H5VLconnector_token_to_str(fid, table->objs[u].obj_token, &obj_tok_str);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is inside a debugging #ifdef, so looks like it was just never updated.

@@ -388,6 +389,13 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t
if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, actual_name_length, p_end))
HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding");

/* Check for duplicated field name */
for (memb_idx = 0; memb_idx < dt->shared->u.compnd.nmembs; memb_idx++)
Copy link
Collaborator Author

@jhendersonHDF jhendersonHDF Mar 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can do this check at the end of decoding a compound datatype and in some efficient way rather than doing it for every single member. That seems like a real performance killer for large compounds.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that it'll be O(n^2) either way... :-/

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we build a temporary hashmap indexed by hashing the member name and use it for lookups?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not something that really needs to hold this PR up, but there are probably some ways we can improve on this.

*-------------------------------------------------------------------------
*/
herr_t
H5G__ent_to_link(H5O_link_t *lnk, const H5HL_t *heap, const H5G_entry_t *ent, const char *name)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function appears to have been moved to H5Gent.c, while H5G__ent_convert() from H5Gent.c was renamed to H5G__link_to_ent() and moved into this file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, made more senes with what the routines were doing

@lrknox lrknox merged commit ce53bc0 into HDFGroup:develop Apr 1, 2024
54 checks passed
lrknox pushed a commit to lrknox/hdf5 that referenced this pull request Apr 1, 2024
derobins added a commit that referenced this pull request Apr 1, 2024
* Relaxed behavior of H5Pset_page_buffer_size() when opening files (#4280)

This API call sets the size of a file's page buffer cache. This call
was extremely strict about matching its parameters to the file strategy
and page size used to create the file, requiring a separate open of the
file to obtain these parameters.

These requirements have been relaxed when using the fapl to open
a previously-created file:

* When opening a file that does not use the H5F_FSPACE_STRATEGY_PAGE
  strategy, the setting is ignored and the file will be opened, but
  without a page buffer cache. This was previously an error.

* When opening a file that has a page size larger than the desired
  page buffer cache size, the page buffer cache size will be increased
  to the file's page size. This was previously an error.

The behavior when creating a file using H5Pset_page_buffer_size() is
unchanged.

Fixes GitHub issue #3382

* chore: improve error message (#4287)

close #192

* changed to if string contains instead (#4286)

* Fix off_t straggers (#4291)

Convert off_t to HDoff_t (mainly for Windows):

* h5jam
* h5unjam
* chunk_info test

* Add missing foreach for VFD and Pasthrough runs (#4292)

* Fixes for file format security issues (#4283)

* Add configure options for disabling extension features (#4277)

Add configure option to enable or disable extension features in general

Add configure option to enable or disable _Float16 support

Add new config options to various settings files

* Add documentation (H5FD) (#4269)

* Use AOCC 4.2 and OpenMPI 4.1.6 (#4290)

* Fix problems with background buffers and array datatypes (#4218)

* Fix bug in array conversion with strided background buffer. Convert some
memmove calls to non-overlapping buffers to memcpy.

* Revert inappropriate use of mempy to memmove in H5T__conv_array

* Add testing

* Add RELEASE.txt note and overwrite test case.

* Synch workflows and require apt-get update (#4294)

* Fix Figure 9. table format in HDF5 Groups User Guide (#4295)

---------

Co-authored-by: Dana Robinson <[email protected]>
Co-authored-by: H. Joe Lee <[email protected]>
Co-authored-by: Scot Breitenfeld <[email protected]>
Co-authored-by: Allen Byrne <[email protected]>
Co-authored-by: jhendersonHDF <[email protected]>
Co-authored-by: bmribler <[email protected]>
Co-authored-by: Neil Fortner <[email protected]>
qkoziol pushed a commit to qkoziol/hdf5 that referenced this pull request Apr 2, 2024
@jhendersonHDF jhendersonHDF deleted the aws_security_fixes branch April 4, 2024 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - C Library Core C library issues (usually in the src directory) Component - Tools Command-line tools like h5dump, includes high-level tools Priority - 0. Blocker ⛔ This MUST be merged for the release to happen Type - Bug / Bugfix Please report security issues to [email protected] instead of creating an issue on GitHub
Projects
Status: Needs Merged
Development

Successfully merging this pull request may close these issues.

4 participants