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

Side by Side Diff: test/unittests/wasm/decoder-unittest.cc

Issue 2410913002: [wasm] Fix decoder for null data (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « src/wasm/decoder.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "test/unittests/test-utils.h" 5 #include "test/unittests/test-utils.h"
6 6
7 #include "src/objects-inl.h" 7 #include "src/objects-inl.h"
8 #include "src/wasm/decoder.h" 8 #include "src/wasm/decoder.h"
9 #include "src/wasm/wasm-macro-gen.h" 9 #include "src/wasm/wasm-macro-gen.h"
10 10
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 TEST_F(DecoderTest, ReadI64v_extra_bits_positive) { 664 TEST_F(DecoderTest, ReadI64v_extra_bits_positive) {
665 // Not OK for positive signed values to have extra ones. 665 // Not OK for positive signed values to have extra ones.
666 unsigned length = 0; 666 unsigned length = 0;
667 byte data[] = {0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x77}; 667 byte data[] = {0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x77};
668 decoder.Reset(data, data + sizeof(data)); 668 decoder.Reset(data, data + sizeof(data));
669 decoder.checked_read_i64v(decoder.start(), 0, &length); 669 decoder.checked_read_i64v(decoder.start(), 0, &length);
670 EXPECT_EQ(10, length); 670 EXPECT_EQ(10, length);
671 EXPECT_FALSE(decoder.ok()); 671 EXPECT_FALSE(decoder.ok());
672 } 672 }
673 673
674 TEST_F(DecoderTest, FailOnNullData) {
675 decoder.Reset(nullptr, 0);
676 decoder.checkAvailable(1);
677 EXPECT_FALSE(decoder.ok());
678 EXPECT_FALSE(decoder.toResult(nullptr).ok());
679 }
680
674 } // namespace wasm 681 } // namespace wasm
675 } // namespace internal 682 } // namespace internal
676 } // namespace v8 683 } // namespace v8
OLDNEW
« no previous file with comments | « src/wasm/decoder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698