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

[BUG] detected memory leaks in H5O__efl_decode hdf5/src/H5Oefl.c #2605

Closed
cniddodi opened this issue Mar 20, 2023 · 1 comment · Fixed by #2656
Closed

[BUG] detected memory leaks in H5O__efl_decode hdf5/src/H5Oefl.c #2605

cniddodi opened this issue Mar 20, 2023 · 1 comment · Fixed by #2656
Assignees
Labels
Component - C Library Core C library issues (usually in the src directory) Confirmed Priority - 1. High 🔼 These are important issues that should be resolved in the next release Type - Bug / Bugfix Please report security issues to help@hdfgroup.org instead of creating an issue on GitHub

Comments

@cniddodi
Copy link

detected memory leaks in H5O__efl_decode hdf5/src/H5Oefl.c

Built from git commit hash 0553fb7
OS: Ubuntu 20.04
Compiler: clang version 11.0

Build options:

  • Shared library disabled
    CC=clang
    CXX=clang++
    CFLAGS="-g -fno-inline -fsanitize=address"
    CXXFLAGS="-g -fno-inline -fsanitize=address"
    LDFLAGS="$LDFLAGS -fsanitize=address"
    ASAN_OPTIONS=abort_on_error=1

Command: ./h5dump pov

POV file:
pov.zip

Stack trace:

==1948296==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 1 byte(s) in 1 object(s) allocated from:
#0 0x4c18c7 in calloc /home/chaitra/aflgo-top/build/llvm_tools/llvm-11.0.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cpp:154:3
#1 0xcc2c04 in H5O__efl_decode hdf5/src/H5Oefl.c:137:37
#2 0x8738c8 in H5O_msg_read_oh hdf5/src/H5Omessage.c:513:5
#3 0x8732df in H5O_msg_read hdf5/src/H5Omessage.c:454:30
#4 0x63d32f in H5D__layout_oh_read hdf5/src/H5Dlayout.c:627:21
#5 0x623906 in H5D_open hdf5/src/H5Dint.c:1498:13
#6 0x622d37 in H5D__open_name hdf5/src/H5Dint.c:1433:25
#7 0xb81750 in H5VL__native_dataset_open hdf5/src/H5VLnative_dataset.c:318:25
#8 0xb5638b in H5VL__dataset_open hdf5/src/H5VLcallback.c:1946:30
SUMMARY: AddressSanitizer: 1 byte(s) leaked in 1 allocation(s).
@derobins derobins self-assigned this Apr 1, 2023
@derobins derobins added Merge - To 1.12 Priority - 1. High 🔼 These are important issues that should be resolved in the next release Component - C Library Core C library issues (usually in the src directory) Type - Bug / Bugfix Please report security issues to help@hdfgroup.org instead of creating an issue on GitHub labels Apr 1, 2023
@derobins
Copy link
Member

derobins commented Apr 1, 2023

develop debug h5dump dumps core with the file:

h5dump: ../../hdf5/src/H5Oefl.c:114: H5O__efl_decode: Assertion `mesg->nalloc > 0' failed.
Aborted (core dumped)

so we'll address that before the memory leak (production mode is fine).

derobins added a commit to derobins/hdf5 that referenced this issue Apr 2, 2023
The function that decodes external data files object header messages
would call assert() when parsing malformed files, causing applications
to crash when linked against the debug library.

This change converts these assert() calls to HDF5 error checks, so
the messages are sanity checked in both release and debug mode and
debug mode no longer crashes applications.

Also cleaned up some error handling usage and debug checks.

Related to GitHub HDFGroup#2605
derobins added a commit to derobins/hdf5 that referenced this issue Apr 2, 2023
derobins added a commit that referenced this issue Apr 3, 2023
* Convert asserts to error handling in efl decode

The function that decodes external data files object header messages
would call assert() when parsing malformed files, causing applications
to crash when linked against the debug library.

This change converts these assert() calls to HDF5 error checks, so
the messages are sanity checked in both release and debug mode and
debug mode no longer crashes applications.

Also cleaned up some error handling usage and debug checks.

* Free memory on H5O efl decode errors

* Add buffer size checks to efl msg decode

* Add parentheses to math expressions

Fixes GitHub #2605
@github-project-automation github-project-automation bot moved this to Merges Complete in Downstream HDF5 Merges Apr 3, 2023
derobins added a commit to derobins/hdf5 that referenced this issue Apr 12, 2023
* Convert asserts to error handling in efl decode

The function that decodes external data files object header messages
would call assert() when parsing malformed files, causing applications
to crash when linked against the debug library.

This change converts these assert() calls to HDF5 error checks, so
the messages are sanity checked in both release and debug mode and
debug mode no longer crashes applications.

Also cleaned up some error handling usage and debug checks.

* Free memory on H5O efl decode errors

* Add buffer size checks to efl msg decode

* Add parentheses to math expressions

Fixes GitHub HDFGroup#2605
derobins added a commit to derobins/hdf5 that referenced this issue Apr 12, 2023
* Convert asserts to error handling in efl decode

The function that decodes external data files object header messages
would call assert() when parsing malformed files, causing applications
to crash when linked against the debug library.

This change converts these assert() calls to HDF5 error checks, so
the messages are sanity checked in both release and debug mode and
debug mode no longer crashes applications.

Also cleaned up some error handling usage and debug checks.

* Free memory on H5O efl decode errors

* Add buffer size checks to efl msg decode

* Add parentheses to math expressions

Fixes GitHub HDFGroup#2605
derobins added a commit to derobins/hdf5 that referenced this issue Apr 12, 2023
The function that decodes external data files object header messages would
call assert() when parsing malformed files, causing applications to crash
when linked against the debug library.

This change converts these assert() calls to HDF5 error checks, so the
messages are sanity checked in both release and debug mode and debug mode
no longer crashes applications.

Also cleaned up some error handling usage and debug checks.

* Free memory on H5O efl decode errors

* Add buffer size checks to efl msg decode

* Add parentheses to math expressions

Fixes GitHub HDFGroup#2605
derobins added a commit that referenced this issue Apr 13, 2023
* Convert asserts to error handling in efl decode

The function that decodes external data files object header messages
would call assert() when parsing malformed files, causing applications
to crash when linked against the debug library.

This change converts these assert() calls to HDF5 error checks, so
the messages are sanity checked in both release and debug mode and
debug mode no longer crashes applications.

Also cleaned up some error handling usage and debug checks.

* Free memory on H5O efl decode errors

* Add buffer size checks to efl msg decode

* Add parentheses to math expressions

Fixes GitHub #2605
derobins added a commit that referenced this issue Apr 13, 2023
* Convert asserts to error handling in efl decode

The function that decodes external data files object header messages
would call assert() when parsing malformed files, causing applications
to crash when linked against the debug library.

This change converts these assert() calls to HDF5 error checks, so
the messages are sanity checked in both release and debug mode and
debug mode no longer crashes applications.

Also cleaned up some error handling usage and debug checks.

* Free memory on H5O efl decode errors

* Add buffer size checks to efl msg decode

* Add parentheses to math expressions

Fixes GitHub #2605
derobins added a commit that referenced this issue Apr 13, 2023
The function that decodes external data files object header messages would
call assert() when parsing malformed files, causing applications to crash
when linked against the debug library.

This change converts these assert() calls to HDF5 error checks, so the
messages are sanity checked in both release and debug mode and debug mode
no longer crashes applications.

Also cleaned up some error handling usage and debug checks.

* Free memory on H5O efl decode errors

* Add buffer size checks to efl msg decode

* Add parentheses to math expressions

Fixes GitHub #2605
derobins added a commit to derobins/hdf5 that referenced this issue Apr 13, 2023
byrnHDF pushed a commit to byrnHDF/hdf5 that referenced this issue Apr 16, 2023
brtnfld pushed a commit to brtnfld/hdf5 that referenced this issue May 17, 2023
* Convert asserts to error handling in efl decode

The function that decodes external data files object header messages
would call assert() when parsing malformed files, causing applications
to crash when linked against the debug library.

This change converts these assert() calls to HDF5 error checks, so
the messages are sanity checked in both release and debug mode and
debug mode no longer crashes applications.

Also cleaned up some error handling usage and debug checks.

* Free memory on H5O efl decode errors

* Add buffer size checks to efl msg decode

* Add parentheses to math expressions

Fixes GitHub HDFGroup#2605
brtnfld pushed a commit to brtnfld/hdf5 that referenced this issue May 17, 2023
brtnfld pushed a commit to brtnfld/hdf5 that referenced this issue Oct 5, 2023
The function that decodes external data files object header messages would
call assert() when parsing malformed files, causing applications to crash
when linked against the debug library.

This change converts these assert() calls to HDF5 error checks, so the
messages are sanity checked in both release and debug mode and debug mode
no longer crashes applications.

Also cleaned up some error handling usage and debug checks.

* Free memory on H5O efl decode errors

* Add buffer size checks to efl msg decode

* Add parentheses to math expressions

Fixes GitHub HDFGroup#2605
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) Confirmed Priority - 1. High 🔼 These are important issues that should be resolved in the next release Type - Bug / Bugfix Please report security issues to help@hdfgroup.org instead of creating an issue on GitHub
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants