Closed jcbollinger closed 4 years ago
Merged
Thank you. Your changes are merged. -- Herbert
On Thu, Apr 30, 2020 at 2:15 PM John Bollinger notifications@github.com wrote:
This commit fixes several undefined and implementation-defined behaviors in libcbf, identified from an analysis of warnings emitted by GCC. The motivation was to address crashes in the nexus2cbf example program that exhibit a sensitivity to (at least) compiler optimization level. Specific issues addressed include
- left-shifting negative integers
- pointer arithmetic involving type void *
- calling a function that has no in-scope declaration
- string / character-array manipulation with dependencies on uninitialized, unset contents of local arrays
- computing a pointer to before the start of an object
- accessing an object (via pointer) after the end of the object's lifetime
It was the last of those, in function _cbf_nx2cbfDread_scalar_string, that seems to have been the main source of the specific problem that motivated these changes.
Fixes #15 https://github.com/yayahjb/cbflib/issues/15
You can view, comment on, or merge this pull request online at:
https://github.com/yayahjb/cbflib/pull/16 Commit Summary
- Fix HDF5-related undefined behavior
File Changes
- M src/cbf.c https://github.com/yayahjb/cbflib/pull/16/files#diff-1c6cd33d24047a2d27ad72a367cf5862 (4)
- M src/cbf_copy.c https://github.com/yayahjb/cbflib/pull/16/files#diff-cb854837d05bce7c6c7a4fa49ad265ce (4)
- M src/cbf_hdf5.c https://github.com/yayahjb/cbflib/pull/16/files#diff-d2880e9cf0131b9eb3defc43a0a31565 (11)
- M src/img.c https://github.com/yayahjb/cbflib/pull/16/files#diff-bb325b77b490c2a3817000fccebe43b1 (2)
Patch Links:
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/yayahjb/cbflib/pull/16, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABB6EAOCGFTUVGTLH6CIU73RPG53XANCNFSM4MWF37IA .
This commit fixes several undefined and implementation-defined behaviors in libcbf, identified from an analysis of warnings emitted by GCC. The motivation was to address crashes in the nexus2cbf example program that exhibit a sensitivity to (at least) compiler optimization level. Specific issues addressed include
void *
It was the last of those, in function
_cbf_nx2cbfDread_scalar_string
, that seems to have been the main source of the specific problem that motivated these changes.Fixes #15