This is an archive of the discontinued LLVM Phabricator instance.

[libc] fix line buffered empty file writes
ClosedPublic

Authored by michaelrj on Jun 15 2022, 4:16 PM.

Details

Summary

Previously, any line buffered write of size 0 would cause an error.
The variable used to track the index of the last newline started at
the size of the write - 1, which underflowed. Now it's handled properly,
and a test has been added to prevent regressions.

Diff Detail

Event Timeline

michaelrj created this revision.Jun 15 2022, 4:16 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 15 2022, 4:16 PM
michaelrj requested review of this revision.Jun 15 2022, 4:16 PM
lntue accepted this revision.Jun 15 2022, 5:21 PM
This revision is now accepted and ready to land.Jun 15 2022, 5:21 PM
sivachandra accepted this revision.Jun 16 2022, 9:13 AM
This revision was automatically updated to reflect the committed changes.