Hotfix: Crash when parsing two object files #81
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@bheath-adobe found a pair of object files that was causing ORC to crash. This set of changes fixes the crash.
Details of the changes:
fetch_one_die
. It was assuming the top of__debug_info
sufficed for this value, which is true for the first compilation unit in the.o
file. (Most.o
files have a single compilation unit, so this "worked".) One of the sample files @bheath-adobe gave me has multiple compilation units in the.o
file, and one of the successive ones was needed for ODRV processing. This causedfetch_one_die
to crash trying to read from the top of__debug_info
when it should have been reading relative to the successive compilation unit header when trying to resolve a type.refN
attribute values are now calculated relative to the compilation unit header offset (which itself is relative to the top of__debug_info
). This used to be a value calculated very strangely; the new calculation is exactly what the DWARF spec expects should happen.__debug_info
or the start of the compilation unit (whose offset is relative to__debug_info
.) Offsets should always be annotated with what their value is relative to.freader
routines, courtesy of @bheath-adobe.