1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
From: terrafrost <terrafrost@gmail.com>
Date: Sat, 3 Apr 2021 11:38:11 -0500
Subject: Tests/ASN1: add test for null garbage bytes
Origin: upstream, https://github.com/phpseclib/phpseclib/pull/1635/commits/dbd210c4a7ffc652a15792ed83125a6f93306a80
---
tests/Unit/File/ASN1Test.php | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/tests/Unit/File/ASN1Test.php b/tests/Unit/File/ASN1Test.php
index 1bd3cbc..eeb6774 100644
--- a/tests/Unit/File/ASN1Test.php
+++ b/tests/Unit/File/ASN1Test.php
@@ -392,4 +392,17 @@ class Unit_File_ASN1Test extends PhpseclibTestCase
$this->assertIsArray($a);
}
+
+ public function testNullGarbage()
+ {
+ $asn1 = new File_ASN1();
+
+ $em = pack('H*', '3080305c0609608648016503040201054f8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888804207509e5bda0c762d2bac7f90d758b5b2263fa01ccbc542ab5e3df163be08e6ca9');
+ $decoded = $asn1->decodeBER($em);
+ $this->assertFalse($decoded[0]);
+
+ $em = pack('H*', '3080307f0609608648016503040201057288888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888804207509e5bda0c762d2bac7f90d758b5b2263fa01ccbc542ab5e3df163be08e6ca90000');
+ $decoded = $asn1->decodeBER($em);
+ $this->assertFalse($decoded[0]);
+ }
}
|