This is an archive of the discontinued LLVM Phabricator instance.

[COFF] Fix reading variable-length encoded records
ClosedPublic

Authored by aganea on Mar 30 2018, 12:38 PM.

Details

Summary

While reading Codeview records which contain variable-length encoded integers,
such as LF_BCLASS, LF_ENUMERATE, LF_MEMBER, LF_VBCLASS or LF_IVBCLASS,
the record's size would be improperly calculated in cases where the value was
indeed variable-length (>= LF_NUMERIC). This caused a bad alignement on the
next record, which would/might crash later on.

Diff Detail

Repository
rL LLVM

Event Timeline

aganea created this revision.Mar 30 2018, 12:38 PM
rnk added inline comments.Mar 30 2018, 2:15 PM
test/DebugInfo/COFF/enum_var.ll
1

I don't think this test exercises the fix. Only type stream merging and LLD exercise type index discovery.

We have a unit test called TypeIndexDiscoveryTest. Could go there.

aganea updated this revision to Diff 140798.Apr 3 2018, 8:07 AM

My bad - I should have tested without the patch. Updated following @zturner's suggestion.

zturner accepted this revision.Apr 9 2018, 9:02 AM
This revision is now accepted and ready to land.Apr 9 2018, 9:02 AM
This revision was automatically updated to reflect the committed changes.