OLD | NEW |
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 Loading... |
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 |
OLD | NEW |