Skip to content

Conversation

@michaelrj-google
Copy link
Contributor

A typo in #165711 caused sanitizer failures (the small buffer was used
for the larger test). Renamed the variables to avoid the mistake in
future.

A typo in llvm#165711 caused sanitizer failures (the small buffer was used
for the larger test). Renamed the variables to avoid the mistake in
future.
@llvmbot
Copy link
Member

llvmbot commented Oct 30, 2025

@llvm/pr-subscribers-libc

Author: Michael Jones (michaelrj-google)

Changes

A typo in #165711 caused sanitizer failures (the small buffer was used
for the larger test). Renamed the variables to avoid the mistake in
future.


Full diff: https://github.com/llvm/llvm-project/pull/165770.diff

1 Files Affected:

  • (modified) libc/test/src/time/strftime_test.cpp (+5-4)
diff --git a/libc/test/src/time/strftime_test.cpp b/libc/test/src/time/strftime_test.cpp
index 38176f77804d5..5222152791905 100644
--- a/libc/test/src/time/strftime_test.cpp
+++ b/libc/test/src/time/strftime_test.cpp
@@ -2329,20 +2329,21 @@ TEST(LlvmLibcStrftimeTest, TimeFormatFullDateTime) {
 
 TEST(LlvmLibcStrftimeTest, BufferTooSmall) {
   struct tm time;
-  char buffer[1];
+  char tiny_buffer[1];
 
   time.tm_year = get_adjusted_year(2025);
   time.tm_mon = 10;
   time.tm_mday = 24;
 
   size_t written =
-      LIBC_NAMESPACE::strftime(buffer, sizeof(buffer), "%F", &time);
+      LIBC_NAMESPACE::strftime(tiny_buffer, sizeof(tiny_buffer), "%F", &time);
   EXPECT_EQ(written, size_t{0});
 
-  char buffer2[10];
+  char small_buffer[10];
 
   // The string "2025-11-24" is 10 chars,
   // so strftime needs 10 + 1 bytes to write the string and the null terminator.
-  written = LIBC_NAMESPACE::strftime(buffer, sizeof(buffer2), "%F", &time);
+  written =
+      LIBC_NAMESPACE::strftime(small_buffer, sizeof(small_buffer), "%F", &time);
   EXPECT_EQ(written, size_t{0});
 }

@michaelrj-google michaelrj-google enabled auto-merge (squash) October 30, 2025 19:32
@michaelrj-google michaelrj-google merged commit 39189c3 into llvm:main Oct 30, 2025
20 of 21 checks passed
@michaelrj-google michaelrj-google deleted the libcStrftimeCorrectBuffer branch October 30, 2025 21:24
luciechoi pushed a commit to luciechoi/llvm-project that referenced this pull request Nov 1, 2025
A typo in llvm#165711 caused sanitizer failures (the small buffer was used
for the larger test). Renamed the variables to avoid the mistake in
future.
DEBADRIBASAK pushed a commit to DEBADRIBASAK/llvm-project that referenced this pull request Nov 3, 2025
A typo in llvm#165711 caused sanitizer failures (the small buffer was used
for the larger test). Renamed the variables to avoid the mistake in
future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants