File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -217,6 +217,8 @@ def remove_integer(string):
217
217
def read_number (string ):
218
218
number = 0
219
219
llen = 0
220
+ if str_idx_as_int (string , 0 ) == 0x80 :
221
+ raise UnexpectedDER ("Non minimal encoding of OID subidentifier" )
220
222
# base-128 big endian, with b7 set in all but the last byte
221
223
while True :
222
224
if llen >= len (string ):
Original file line number Diff line number Diff line change @@ -311,6 +311,14 @@ def test_with_large_second_subid(self):
311
311
self .assertEqual (rest , b'' )
312
312
self .assertEqual (oid , (2 , 999 , 3 ))
313
313
314
+ def test_with_padded_first_subid (self ):
315
+ with self .assertRaises (UnexpectedDER ):
316
+ remove_object (b'\x06 \x02 \x80 \x00 ' )
317
+
318
+ def test_with_padded_second_subid (self ):
319
+ with self .assertRaises (UnexpectedDER ):
320
+ remove_object (b'\x06 \x04 \x88 \x37 \x80 \x01 ' )
321
+
314
322
def test_with_missing_last_byte_of_multi_byte (self ):
315
323
with self .assertRaises (UnexpectedDER ):
316
324
remove_object (b'\x06 \x03 \x88 \x37 \x83 ' )
You can’t perform that action at this time.
0 commit comments