Skip to content
This repository has been archived by the owner on Dec 9, 2018. It is now read-only.

assert() calls leave build path in generated executable #668

Open
josch opened this issue Aug 23, 2016 · 0 comments
Open

assert() calls leave build path in generated executable #668

josch opened this issue Aug 23, 2016 · 0 comments

Comments

@josch
Copy link

josch commented Aug 23, 2016

Hi,

currently, the following files contain assert() calls:

  • src/HTMLRenderer/general.cc
  • src/HTMLRenderer/font.cc
  • src/HTMLRenderer/state.cc
  • src/BackgroundRenderer/SplashBackgroundRenderer.cc
  • src/util/ffw.c
  • src/ArgParser.cc
  • src/HTMLTextLine.cc
  • src/StringFormatter.cc

This means that building pdf2htmlEX will by default include the full path to these files in the resulting binaries because assert() uses the __FILE__ macro internally. This is problematic for two reasons:

  • the binary will look different when compiled on different systems with different build paths. This makes it harder to compare whether the produced binary matches the expected binary. For arguments why compiling software should yield the same results independent of who builds it read https://reproducible-builds.org/
  • the absolute path might contain sensitive information that the user building pdf2htmlEX might not want to disclose. By not including the build path in the resulting binaries, the user will not accidentally share the path.

I see two ways to fix the problem:

  • replace all calls to assert() by normal if/else constructs with the usual error handling
  • build the code with NDEBUG being defined by default

What do you think?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant