This is an archive of the discontinued LLVM Phabricator instance.

[libc] Fix a bug in file write logic.
AbandonedPublic

Authored by sivachandra on Jun 7 2022, 11:18 AM.

Details

Reviewers
lntue
michaelrj
Summary

A bug when writing data much larger than the file buffer is fixed.

Diff Detail

Event Timeline

sivachandra created this revision.Jun 7 2022, 11:18 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 7 2022, 11:18 AM
sivachandra requested review of this revision.Jun 7 2022, 11:18 AM
lntue accepted this revision.Jun 8 2022, 9:38 AM
This revision is now accepted and ready to land.Jun 8 2022, 9:38 AM
michaelrj added inline comments.Jun 8 2022, 10:14 AM
libc/src/__support/File/file.cpp
63

needs to be dataref[i+write_size]

libc/test/src/__support/File/file_test.cpp
135

add the following to prevent regressions:

MemoryView src1("hello, file\0hello, file", sizeof(data) * 2),
    dst1(f->get_str(), sizeof(data) * 2);
EXPECT_MEM_EQ(src1, dst1);
sivachandra abandoned this revision.May 19 2023, 12:40 AM