Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Unified Diff: test/unittests/value-serializer-unittest.cc

Issue 2399873002: ValueSerializer: Add more checks before trying to allocate memory for a dense array. (Closed)
Patch Set: signed/unsigned Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/value-serializer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/value-serializer-unittest.cc
diff --git a/test/unittests/value-serializer-unittest.cc b/test/unittests/value-serializer-unittest.cc
index d88d60a3e6a6c1a217d1c1476c51e91d6ec7073c..06e83303cfb9408ff4e0c542a614ff74ffe76646 100644
--- a/test/unittests/value-serializer-unittest.cc
+++ b/test/unittests/value-serializer-unittest.cc
@@ -977,6 +977,14 @@ TEST_F(ValueSerializerTest, DecodeArray) {
});
}
+TEST_F(ValueSerializerTest, DecodeInvalidOverLargeArray) {
+ // So large it couldn't exist in the V8 heap, and its size couldn't fit in a
+ // SMI on 32-bit systems (2^30).
+ InvalidDecodeTest({0xff, 0x09, 0x41, 0x80, 0x80, 0x80, 0x80, 0x04});
+ // Not so large, but there isn't enough data left in the buffer.
+ InvalidDecodeTest({0xff, 0x09, 0x41, 0x01});
+}
+
TEST_F(ValueSerializerTest, RoundTripArrayWithNonEnumerableElement) {
// Even though this array looks like [1,5,3], the 5 should be missing from the
// perspective of structured clone, which only clones properties that were
« no previous file with comments | « src/value-serializer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698