yayahjb / cbflib

CBFlib repository cloned from SF CBFlib repository as of 1 Dec 15
8 stars 20 forks source link

Fix HDF5-related undefined behavior #16

Closed jcbollinger closed 4 years ago

jcbollinger commented 4 years ago

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

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

yayahjb commented 4 years ago

Merged

yayahjb commented 4 years ago

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

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 .