ASN1: don't allow last octet in OID to have MSB set

This commit is contained in:
terrafrost 2021-04-02 10:43:15 -05:00
parent 2d6705dfbd
commit b90c33200e

View File

@ -517,6 +517,9 @@ class File_ASN1
break; break;
case FILE_ASN1_TYPE_OBJECT_IDENTIFIER: case FILE_ASN1_TYPE_OBJECT_IDENTIFIER:
$current['content'] = $this->_decodeOID(substr($content, $content_pos)); $current['content'] = $this->_decodeOID(substr($content, $content_pos));
if ($current['content'] === false) {
return false;
}
break; break;
/* Each character string type shall be encoded as if it had been declared: /* Each character string type shall be encoded as if it had been declared:
[UNIVERSAL x] IMPLICIT OCTET STRING [UNIVERSAL x] IMPLICIT OCTET STRING
@ -1228,6 +1231,11 @@ class File_ASN1
$oid = array(); $oid = array();
$pos = 0; $pos = 0;
$len = strlen($content); $len = strlen($content);
if (ord($content[$len - 1]) & 0x80) {
return false;
}
$n = new Math_BigInteger(); $n = new Math_BigInteger();
while ($pos < $len) { while ($pos < $len) {
$temp = ord($content[$pos++]); $temp = ord($content[$pos++]);