False positive on LocationParser.attribute_has_location() #501
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.
The description of
DW_AT_member_location
changed between DWARFv2 and DWARFv3:v2, section 5.5.4:
v3, section 5.5.6:
The case of DW_AT_data_member_location containing an integer constant is not handled by pyelftools - the method
LocationParser.attribute_has_location()
returns True, and it shouldn't.I have a crash report where an attribute with the following data:
AttributeValue(name='DW_AT_data_member_location', form='DW_FORM_data1', value=0, raw_value=0, offset=402, indirection_length=0)
is being interpreted as a location list pointer (
LocationParser.parse_from_attribute()
tries to parse it), which in turn exceptions, because the binary doesn't contain a loclist section (self.location_lists
is None).