Otherwise if the file existed and was larger than the write size before the OpenFile call, the file will not be truncated and contain garbage in trailing bytes.
Details
Diff Detail
- Repository
- rCRT Compiler Runtime
- Build Status
Buildable 19396 Build 19396: arc lint + arc unit
Event Timeline
Could you please add corresponding check into "TEST(SanitizerCommon, FileOps)" and make sure that all platforms have the same behavior.
Added test. BTW, is my testing correct?
% ninja -C ~/Dev/llvm/release TSanitizer-i386-Test TSanitizer-x86_64-Test TSanitizer-x86_64-Test-Nolibc && ~/Dev/llvm/release/projects/ compiler-rt/lib/sanitizer_common/tests/Sanitizer-i386-Test && ~/Dev/llvm/release/projects/compiler-rt/lib/sanitizer_common/tests/Sanitiz er-x86_64-Test # passed
lib/sanitizer_common/sanitizer_posix.cc | ||
---|---|---|
163 | please also fix windows looks good |
Thanks for informing me of the check-sanitizer target. 64 SanitizerCommon-lsan-i386-Linux tests already fail before this revision. All other tests pass.
lib/sanitizer_common/sanitizer_solaris.cc | ||
---|---|---|
81 ↗ | (On Diff #151600) | This function has different signature. @krytarowski I don't see any calls to this function. Is this here accidentally? |
lib/sanitizer_common/sanitizer_solaris.cc | ||
---|---|---|
81 ↗ | (On Diff #151600) | I don't know much about the file history. But I guess the signature of OpenFile has changed from two parameters to three parameters at some point and the solaris version does not catch up. // Returns kInvalidFd on error. fd_t OpenFile(const char *filename, FileAccessMode mode, error_t *errno_p = nullptr); Just reverted the change to the solaris file. |
please also fix
compiler-rt/lib/sanitizer_common/sanitizer_rtems.cc
windows looks good
compiler-rt/lib/sanitizer_common/sanitizer_win.cc