summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_printf.cc2
-rw-r--r--compiler-rt/lib/sanitizer_common/tests/sanitizer_printf_test.cc9
2 files changed, 2 insertions, 9 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc b/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc
index 59f9b970178..5c2360043b0 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc
@@ -105,8 +105,6 @@ static int AppendString(char **buff, const char *buff_end, int precision,
break;
result += AppendChar(buff, buff_end, *s);
}
- while (result < precision)
- result += AppendChar(buff, buff_end, ' ');
return result;
}
diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_printf_test.cc b/compiler-rt/lib/sanitizer_common/tests/sanitizer_printf_test.cc
index f8dac894256..5a77b470caf 100644
--- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_printf_test.cc
+++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_printf_test.cc
@@ -146,13 +146,8 @@ TEST(Printf, Precision) {
EXPECT_EQ(3U, len);
EXPECT_STREQ("123", buf);
len = internal_snprintf(buf, sizeof(buf), "%.*s", 6, "12345");
- EXPECT_EQ(6U, len);
- EXPECT_STREQ("12345 ", buf);
- // CHeck that precision does not overflow the smaller buffer, although
- // 10 chars is requested, it stops at the buffer size, 8.
- len = internal_snprintf(buf, 8, "%.*s", 10, "12345");
- EXPECT_EQ(10U, len); // The required size reported.
- EXPECT_STREQ("12345 ", buf);
+ EXPECT_EQ(5U, len);
+ EXPECT_STREQ("12345", buf);
}
} // namespace __sanitizer
OpenPOWER on IntegriCloud