Skip to content

Conversation

crzysdrs
Copy link
Contributor

@crzysdrs crzysdrs commented Sep 11, 2025

DW_FORM_data16 provided to DW_AT_upper_bound was being incorrectly being converted to an AttributeValue::Block causing the exprloc_value function to interpret it as a bunch of bytes representing an expression. This expression when parsed was an invalid set of bytes.

This can be demonstrated by running the simple_convert example over the following testcase.

Attached Example:
dw_form.tar.gz

It should be noted that the example also has line programs that are newer versions than the units they are embedded in and will fail a consistency check when writing the LineProgram. This can be ignored by commenting out the check in src/write/line.rs. See #798.

Also we are using a cherry-picked version of #787

Copy link
Collaborator

@philipc philipc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add some tests for this? (They should have existed already but got missed). Two tests similar to the data8 tests should be enough (read and write).

Also note that the line program parser still reads DW_FORM_data16 as a block, but we want it to keep doing that because it's used for MD5 hashes.

@crzysdrs
Copy link
Contributor Author

crzysdrs commented Sep 17, 2025

Tests added.

It appears that the line program has its own parse_attribute function that I have not altered, so it should continue to parse data16 as Block.

There was one other concern I had around some extra logic in the parsing of data4,8 here that appears to handle some possible differences in dwarf2/3 regarding section offsets. My assumption was that this does not apply to data16 so I didn't copy this but I don't have any evidence to support that.

@philipc
Copy link
Collaborator

philipc commented Sep 17, 2025

My assumption was that this does not apply to data16 so I didn't copy this but I don't have any evidence to support that.

Yes, not needed for data16 because there's no Format::Dwarf128.

Copy link
Collaborator

@philipc philipc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@philipc philipc merged commit 5a12eb5 into gimli-rs:master Sep 17, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants