[all-commits] [llvm/llvm-project] 5bcda1: [libc] fix line buffered empty file writes

michaelrj-google via All-commits all-commits at lists.llvm.org
Thu Jun 16 09:55:09 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5bcda1d3a93797aabe00d9a6ddc2ecc6ab5e7c15
      https://github.com/llvm/llvm-project/commit/5bcda1d3a93797aabe00d9a6ddc2ecc6ab5e7c15
  Author: Michael Jones <michaelrj at google.com>
  Date:   2022-06-16 (Thu, 16 Jun 2022)

  Changed paths:
    M libc/src/__support/File/file.cpp
    M libc/test/src/__support/File/file_test.cpp

  Log Message:
  -----------
  [libc] fix line buffered empty file writes

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.

Reviewed By: sivachandra, lntue

Differential Revision: https://reviews.llvm.org/D127914




More information about the All-commits mailing list