Skip to content

WIP: Detecting corrupted interface files #18182

Richard Laughlin requested to merge rcythr/ghc:wip/T18182 into master

This MR changes the behavior of readBinIface and writeBinIface from compiler/GHC/Iface/Binary.hs to check that the filesize of the *.hi file matches the expected size.

I'm also working on a checksum of some kind that won't impact performance too much, but provide a sanity check against accidental corruption.

Please take a few moments to verify that your commits fulfill the following:

  • are either individually buildable or squashed
  • have commit messages which describe what they do (referring to [Notes][notes] and tickets using #NNNN syntax when appropriate)
  • have added source comments describing your change. For larger changes you likely should add a [Note][notes] and cross-reference it from the relevant places.
  • add a testcase to the testsuite.
  • ~~if your MR affects library interfaces (e.g. changes base) or affects whether GHC will accept user-written code, please add the ~"user facing" label.~~
  • updates the users guide if applicable
  • mentions new features in the release notes for the next release

Perhaps a good test case to add for this is one that tries to load a purposefully corrupted .hi file and sees that it was detected. I'll add that too.

Merge request reports