Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Commit 64a9745

Browse files
committed
Fixed HHVM-178: Throw exception if Binary subtype is out of range
1 parent 1608846 commit 64a9745

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ext_mongodb.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,10 @@ final class Binary implements Type, \Serializable
657657

658658
public function __construct(private string $data, private int $type)
659659
{
660+
if ( $type < 0 || $type > 255 )
661+
{
662+
throw new \MongoDB\Driver\Exception\InvalidArgumentException( "Expected type to be an unsigned 8-bit integer, {$type} given" );
663+
}
660664
}
661665

662666
public function getType()

0 commit comments

Comments
 (0)