Add a regression test for a fixed strnlen bug.

Bug: https://code.google.com/p/android/issues/detail?id=74741
Change-Id: I78b0114bdbe8e680b0e938af608a634e73c86eda
This commit is contained in:
Elliott Hughes 2015-07-27 20:55:03 -07:00
parent cebef1a781
commit d2a9fb3267

View File

@ -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)));