This is an archive of the discontinued LLVM Phabricator instance.

Prevent unaligned memory read in parseMinidumpString
ClosedPublic

Authored by teemperor on Jan 20 2018, 11:47 PM.

Details

Summary

It's possible to hit an unaligned memory read when reading source_length as the data array is only aligned with 2 bytes (it's actually a UTF16 array). This patch memcpy's source_length into a local variable to prevent this:

MinidumpTypes.cpp:49:23: runtime error: load of misaligned address 0x7f0f4792692a for type 'const uint32_t' (aka 'const unsigned int'), which requires 4 byte alignment

Diff Detail

Repository
rL LLVM

Event Timeline

teemperor created this revision.Jan 20 2018, 11:47 PM
davide added a subscriber: davide.Jan 21 2018, 12:15 PM

I'll be happy to review all your patch set tomorrow, Raphael. Do you mind to add me as reviewer so I don't lose track of your work?

Thanks, I think only this and the first GoParser patch ( D42339 ) needs some double checking, the others ( D42346, D42338 ) are trivial and I'll merge in the next few hours as zturner suggested.

davide accepted this revision.Jan 22 2018, 7:17 AM

LGTM. Did you run the testsuite? If it's clean, feel free to merge.

This revision is now accepted and ready to land.Jan 22 2018, 7:17 AM
This revision was automatically updated to reflect the committed changes.