Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove check on debug directory size #313

Merged
merged 1 commit into from
Jun 5, 2022
Merged

Conversation

lzybkr
Copy link
Contributor

@lzybkr lzybkr commented Jun 3, 2022

The well intentioned check on debug directory size unfortunately results
in an error when debug information is embedded in the image.

Tools like Digital Mars embed CV debug info in the image instead of
creating a PDB, and some older tools embed COFF debug info in the image.

The well intentioned check on debug directory size unfortunately results
in an error when debug information is embedded in the image.

Tools like Digital Mars embed CV debug info in the image instead of
creating a PDB, and some older tools embed COFF debug info in the image.
@@ -150,8 +150,8 @@ impl<'a> CodeviewPDB70DebugInfo<'a> {

// calculate how long the eventual filename will be, which doubles as a check of the record size
let filename_length = idd.size_of_data as isize - 24;
if filename_length < 0 || filename_length > 1024 {
// the record is too short or too long to be plausible
if filename_length < 0 {
Copy link
Owner

Choose a reason for hiding this comment

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

Is there no maximum bound to check against ? (Worried about regressions if removing this)

also curious the number 1024 was used, I wonder why that was chosen ? (Haven’t looked at this code in a while)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

1024 is an odd choice - MAX_PATH + some small constant factor (to include the hash and other data in the section) seems reasonable, but 1024 is a bit bigger than I'd expect for the typical size of the directory.

That said, I don't think there is a maximum bound - and as this crate is typically used, the memory is already mapped/allocated, so it's mostly harmless to remove the check.

@m4b m4b merged commit 41ad90c into m4b:master Jun 5, 2022
@m4b
Copy link
Owner

m4b commented Jun 5, 2022

@lzybkr thank you!

@m4b
Copy link
Owner

m4b commented Jun 6, 2022

ok released in 0.5.2, thanks for your help!

@lzybkr lzybkr deleted the debug_dir_size branch June 6, 2022 16:15
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