LIEF may fail to serialize an otherwise parseable ELF file, including when a replacement RUNPATH requires more dynamic-string storage. Writing directly to the requested path could therefore truncate a working executable before verification detected the failure.
Write to a same-directory temporary file, preserve permissions, parse and verify the result, and only then atomically replace the original. Failed updates now leave the input intact and remove temporary output.
- Added pre-write writability check before calling binfo->write(...).
- Added post-write verification by reparsing the modified ELF and confirming requested dynamic entries persisted.
- Verification now works with the current code paths, including selective RPATH append/prepend behavior.
- Reused soname_value for --print-soname so SONAME parsing is centralized.
This program basically arose out of this issue:
https://github.com/lief-project/LIEF/issues/364
It's enough to do what BRL-CAD needs - currently it only exposes a small
fraction of the full potential of LIEF.