Skip to content

Commit

Permalink
FIX: don't silently ignore leading zero byte in the der codec data
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Apr 10, 2022
1 parent 811d229 commit 2ce523d
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/mezz/codec-der.reb
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,16 @@ register-codec [
wl: length? form length? data
wr: negate wl
]
if data/1 <> 48 [
if verbose > 0 [
prin "*** DER data does not start with SEQUENCE tag ***^/*** "
probe copy/part data 10

case [
all [data/1 = 0 data/2 = 48][data: next data]
data/1 <> 48 [
if verbose > 0 [
prin "*** DER data does not start with SEQUENCE tag ***^/*** "
probe copy/part data 10
]
return none
]
return none
]

der: binary data
Expand Down Expand Up @@ -118,12 +122,12 @@ register-codec [
;data: none
;]
BIT_STRING [
if data/1 = 0 [data: next data]
;@@if data/1 = 0 [data: next data]
;data: enbase data 2
]
INTEGER [
;@@ TODO: review if the null skipping is correct!
if data/1 = 0 [data: next data]
;@@if data/1 = 0 [data: next data]
]
]
if data [
Expand Down

0 comments on commit 2ce523d

Please sign in to comment.