Skip to content

Commit fc6bc45

Browse files
committed
Test edge cases when unpacking map keys
1 parent d3d3f61 commit fc6bc45

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/Unit/BufferUnpackerTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ public function provideInsufficientData() : array
8484
'int64' => ["\xd3"],
8585
'float32' => ["\xca"],
8686
'float64' => ["\xcb"],
87+
'mapkey' => ["\xdf\x00\x00\x00\x01"],
88+
'mapkey_uint64' => ["\xdf\x00\x00\x00\x01\xcf"],
8789
'fixext1' => ["\xd4"],
8890
'fixext1t' => ["\xd4\x01"],
8991
'fixext2' => ["\xd5"],
@@ -675,6 +677,9 @@ public function provideMapWithInvalidKeyData() : iterable
675677
yield ["\x81{$packed}\x00", $type]; // [$raw => 0]
676678
}
677679
}
680+
681+
// unknown key type
682+
yield ["\x81\xc1\x00", '0xc1'];
678683
}
679684

680685
public function testOverflowedUint64MapKeyIsConvertedToString() : void

0 commit comments

Comments
 (0)