Merge branch '1.0' into 2.0

This commit is contained in:
terrafrost 2016-08-28 10:45:04 -05:00
commit 281cfcdcea
2 changed files with 11 additions and 1 deletions

View File

@ -305,7 +305,7 @@ class ASN1
$newcontent = array(); $newcontent = array();
$remainingLength = $length; $remainingLength = $length;
while ($remainingLength > 0) { while ($remainingLength > 0) {
$temp = $this->_decode_ber($content, $start); $temp = $this->_decode_ber($content, $start, $content_pos);
$length = $temp['length']; $length = $temp['length'];
// end-of-content octets - see paragraph 8.1.5 // end-of-content octets - see paragraph 8.1.5
if (substr($content, $content_pos + $length, 2) == "\0\0") { if (substr($content, $content_pos + $length, 2) == "\0\0") {

View File

@ -289,4 +289,14 @@ class Unit_File_ASN1Test extends PhpseclibTestCase
$this->assertInternalType('array', $decoded); $this->assertInternalType('array', $decoded);
$this->assertCount(0, $decoded[0]['content']); $this->assertCount(0, $decoded[0]['content']);
} }
/**
* @group github1027
*/
public function testInfiniteLoop()
{
$asn1 = new File_ASN1();
$data = base64_decode('MD6gJQYKKwYBBAGCNxQCA6AXDBVvZmZpY2VAY2VydGRpZ2l0YWwucm+BFW9mZmljZUBjZXJ0ZGlnaXRhbC5ybw==');
$asn1->decodeBER($data);
}
} }