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