summaryrefslogtreecommitdiff
path: root/libutils/FileMap_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libutils/FileMap_test.cpp')
-rw-r--r--libutils/FileMap_test.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/libutils/FileMap_test.cpp b/libutils/FileMap_test.cpp
index 9f7ce85ca..fd1c9b0a0 100644
--- a/libutils/FileMap_test.cpp
+++ b/libutils/FileMap_test.cpp
@@ -52,3 +52,16 @@ TEST(FileMap, large_offset) {
ASSERT_EQ(0u, m.getDataLength());
ASSERT_EQ(offset, m.getDataOffset());
}
+
+TEST(FileMap, offset_overflow) {
+ // Make sure that an end that overflows SIZE_MAX will not abort.
+ // See http://b/156997193.
+ TemporaryFile tf;
+ ASSERT_TRUE(tf.fd != -1);
+
+ off64_t offset = 200;
+ size_t length = SIZE_MAX;
+
+ android::FileMap m;
+ ASSERT_FALSE(m.create("test", tf.fd, offset, length, true));
+}