summaryrefslogtreecommitdiff
path: root/tests/string_test.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-07-27 20:55:03 -0700
committerElliott Hughes <enh@google.com>2015-07-27 20:55:03 -0700
commitd2a9fb326769900b786ef36aa0ccf60a65fe497e (patch)
tree359eebb258e59dbd1b72fbc409f60db718c94c24 /tests/string_test.cpp
parentcebef1a7812fe3552f12dd7e885a1f879a9946ed (diff)
Add a regression test for a fixed strnlen bug.
Bug: https://code.google.com/p/android/issues/detail?id=74741 Change-Id: I78b0114bdbe8e680b0e938af608a634e73c86eda
Diffstat (limited to 'tests/string_test.cpp')
-rw-r--r--tests/string_test.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/string_test.cpp b/tests/string_test.cpp
index 1d63c7668..cf9004567 100644
--- a/tests/string_test.cpp
+++ b/tests/string_test.cpp
@@ -22,6 +22,7 @@
#include <gtest/gtest.h>
#include <malloc.h>
#include <math.h>
+#include <stdint.h>
#include "buffer_tests.h"
@@ -1396,6 +1397,10 @@ TEST(string, strnlen_147048) {
delete[] heap_src;
}
+TEST(string, strnlen_74741) {
+ ASSERT_EQ(4U, strnlen("test", SIZE_MAX));
+}
+
TEST(string, mempcpy) {
char dst[6];
ASSERT_EQ(&dst[4], reinterpret_cast<char*>(mempcpy(dst, "hello", 4)));