Page MenuHomePhabricator

dirs: fix trivial over-read of input data
ClosedPublic

Authored by durin42 on Wed, Oct 9, 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.Wed, Oct 9, 11:00 AM
indygreg accepted this revision.Wed, Oct 9, 11:17 PM
This revision is now accepted and ready to land.Wed, Oct 9, 11:17 PM
This revision was automatically updated to reflect the committed changes.