@@ -128,17 +128,14 @@ def decode_length(input):
128
128
return (0 , 1 , str )
129
129
elif prefix <= 0x b7 and length > prefix - 0x 80 :
130
130
strLen = prefix - 0x 80
131
- # ADDED:
132
131
if strLen == 1 and ord (input [1 ]) <= 0x 7f :
133
132
raise Exception (" single byte below 128 must be encoded as itself" )
134
133
return (1 , strLen, str )
135
134
elif prefix <= 0x bf and length > prefix - 0x b7 and length > prefix - 0x b7 + to_integer(substr(input , 1 , prefix - 0x b7 )):
136
135
lenOfStrLen = prefix - 0x b7
137
- # ADDED:
138
136
if input [1 ] == 0 :
139
137
raise Exception (" multi-byte length must have no leading zero" );
140
138
strLen = to_integer(substr(input , 1 , lenOfStrLen))
141
- # ADDED:
142
139
if strLen < 56 :
143
140
raise Exception (" length below 56 must be encoded in one byte" );
144
141
return (1 + lenOfStrLen, strLen, str )
@@ -147,11 +144,9 @@ def decode_length(input):
147
144
return (1 , listLen, list )
148
145
elif prefix <= 0x ff and length > prefix - 0x f7 and length > prefix - 0x f7 + to_integer(substr(input , 1 , prefix - 0x f7 )):
149
146
lenOfListLen = prefix - 0x f7
150
- # ADDED:
151
147
if input [1 ] == 0 :
152
148
raise Exception (" multi-byte length must have no leading zero" );
153
149
listLen = to_integer(substr(input , 1 , lenOfListLen))
154
- # ADDED:
155
150
if listLen < 56 :
156
151
raise Exception (" length below 56 must be encoded in one byte" );
157
152
return (1 + lenOfListLen, listLen, list )
0 commit comments