summaryrefslogtreecommitdiffstats
path: root/base/tools_sanity_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'base/tools_sanity_unittest.cc')
-rw-r--r--base/tools_sanity_unittest.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/base/tools_sanity_unittest.cc b/base/tools_sanity_unittest.cc
index d4b27a5..2f758e2 100644
--- a/base/tools_sanity_unittest.cc
+++ b/base/tools_sanity_unittest.cc
@@ -35,6 +35,14 @@ TEST(ToolsSanityTest, MemoryLeak) {
leak[4] = 1; // Make sure the allocated memory is used.
}
+void ReadUninitializedValue(char *ptr) {
+ if (*ptr == true) {
+ (*ptr)++;
+ } else {
+ (*ptr)--;
+ }
+}
+
void ReadValueOutOfArrayBoundsLeft(char *ptr) {
LOG(INFO) << "Reading a byte out of bounds: " << ptr[-2];
}
@@ -54,6 +62,7 @@ void WriteValueOutOfArrayBoundsRight(char *ptr, size_t size) {
}
void MakeSomeErrors(char *ptr, size_t size) {
+ ReadUninitializedValue(ptr);
ReadValueOutOfArrayBoundsLeft(ptr);
ReadValueOutOfArrayBoundsRight(ptr, size);
WriteValueOutOfArrayBoundsLeft(ptr);