This is an archive of the discontinued Mercurial Phabricator instance.

dirs: fix trivial over-read of input data
ClosedPublic

Authored by durin42 on Oct 9 2019, 11:00 AM.

Details

Summary

This code, introduced in 8c0a7eeda06d, was intentionally over-reading
an input string to avoid getting a shared string object for a one-byte
input. Unfortunately with an empty input (like in the case of a fuzzer
getting started) this was a trivial over-read and triggered an
AddressSanitizer failure.

I went out of my way to make sure the code still does the
copy-avoidance tricks. I don't think this change will cost us much
performance since the one-character strings should be cached
aggressively anyway.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

durin42 created this revision.Oct 9 2019, 11:00 AM
indygreg accepted this revision.Oct 9 2019, 11:17 PM
This revision is now accepted and ready to land.Oct 9 2019, 11:17 PM
This revision was automatically updated to reflect the committed changes.