Page MenuHomePhabricator

Fix out-of-bounds read in Stream::PutCStringAsRawHex8
ClosedPublic

Authored by teemperor on Aug 1 2018, 10:48 AM.

Details

Summary

When I added the Stream unit test (r338488), the build bots failed due to an out-of-
bound reads when passing an empty string to the PutCStringAsRawHex8 method.
In r338491 I removed the test case to fix the bots.

This patch fixes this in PutCStringAsRawHex8 by always checking for the terminating
null character in the given string (instead of skipping it the first time). It also re-adds the
test case I removed.

Diff Detail

Repository
rL LLVM

Event Timeline

teemperor created this revision.Aug 1 2018, 10:48 AM
vsk accepted this revision.Aug 1 2018, 1:02 PM
vsk added a subscriber: vsk.

Thanks, LGTM.

This revision is now accepted and ready to land.Aug 1 2018, 1:02 PM
This revision was automatically updated to reflect the committed changes.