@@ -427,14 +427,14 @@ def valueDecoder(self, substrate, asn1Spec,
427427 if not chunk :
428428 raise error .PyAsn1Error ('Empty substrate' )
429429
430- oid = ()
430+ oid = []
431431 index = 0
432432 substrateLen = len (chunk )
433433 while index < substrateLen :
434434 subId = chunk [index ]
435435 index += 1
436436 if subId < 128 :
437- oid += (subId , )
437+ oid . append (subId )
438438 elif subId > 128 :
439439 # Construct subid from a number of octets
440440 nextSubId = subId
@@ -450,11 +450,11 @@ def valueDecoder(self, substrate, asn1Spec,
450450 subId = (subId << 7 ) + (nextSubId & 0x7F )
451451 if index >= substrateLen :
452452 raise error .SubstrateUnderrunError (
453- 'Short substrate for sub-OID past %s' % (oid ,)
453+ 'Short substrate for sub-OID past %s' % (tuple ( oid ) ,)
454454 )
455455 nextSubId = chunk [index ]
456456 index += 1
457- oid += ((subId << 7 ) + nextSubId , )
457+ oid . append ((subId << 7 ) + nextSubId )
458458 elif subId == 128 :
459459 # ASN.1 spec forbids leading zeros (0x80) in OID
460460 # encoding, tolerating it opens a vulnerability. See
@@ -464,15 +464,17 @@ def valueDecoder(self, substrate, asn1Spec,
464464
465465 # Decode two leading arcs
466466 if 0 <= oid [0 ] <= 39 :
467- oid = (0 ,) + oid
467+ oid . insert (0 , 0 )
468468 elif 40 <= oid [0 ] <= 79 :
469- oid = (1 , oid [0 ] - 40 ) + oid [1 :]
469+ oid [0 ] -= 40
470+ oid .insert (0 , 1 )
470471 elif oid [0 ] >= 80 :
471- oid = (2 , oid [0 ] - 80 ) + oid [1 :]
472+ oid [0 ] -= 80
473+ oid .insert (0 , 2 )
472474 else :
473475 raise error .PyAsn1Error ('Malformed first OID octet: %s' % chunk [0 ])
474476
475- yield self ._createComponent (asn1Spec , tagSet , oid , ** options )
477+ yield self ._createComponent (asn1Spec , tagSet , tuple ( oid ) , ** options )
476478
477479
478480class RelativeOIDPayloadDecoder (AbstractSimplePayloadDecoder ):
@@ -492,14 +494,14 @@ def valueDecoder(self, substrate, asn1Spec,
492494 if not chunk :
493495 raise error .PyAsn1Error ('Empty substrate' )
494496
495- reloid = ()
497+ reloid = []
496498 index = 0
497499 substrateLen = len (chunk )
498500 while index < substrateLen :
499501 subId = chunk [index ]
500502 index += 1
501503 if subId < 128 :
502- reloid += (subId , )
504+ reloid . append (subId )
503505 elif subId > 128 :
504506 # Construct subid from a number of octets
505507 nextSubId = subId
@@ -515,19 +517,19 @@ def valueDecoder(self, substrate, asn1Spec,
515517 subId = (subId << 7 ) + (nextSubId & 0x7F )
516518 if index >= substrateLen :
517519 raise error .SubstrateUnderrunError (
518- 'Short substrate for sub-OID past %s' % (reloid ,)
520+ 'Short substrate for sub-OID past %s' % (tuple ( reloid ) ,)
519521 )
520522 nextSubId = chunk [index ]
521523 index += 1
522- reloid += ((subId << 7 ) + nextSubId , )
524+ reloid . append ((subId << 7 ) + nextSubId )
523525 elif subId == 128 :
524526 # ASN.1 spec forbids leading zeros (0x80) in OID
525527 # encoding, tolerating it opens a vulnerability. See
526528 # https://www.esat.kuleuven.be/cosic/publications/article-1432.pdf
527529 # page 7
528530 raise error .PyAsn1Error ('Invalid octet 0x80 in RELATIVE-OID encoding' )
529531
530- yield self ._createComponent (asn1Spec , tagSet , reloid , ** options )
532+ yield self ._createComponent (asn1Spec , tagSet , tuple ( reloid ) , ** options )
531533
532534
533535class RealPayloadDecoder (AbstractSimplePayloadDecoder ):
0 commit comments