Skip to content

Commit

Permalink
fix: update code
Browse files Browse the repository at this point in the history
Signed-off-by: Junjie Gao <[email protected]>
  • Loading branch information
JeyJeyGao committed Aug 3, 2023
1 parent b9c73bd commit 6cfbd9c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/encoding/asn1/asn1.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ func decode(r []byte) (value, error) {
// top
v := valueStack[stackLen-1]

// the constructed value has been docoded
// check that the constructed value is fully encoded
if len(v.rawContent) == 0 {
// calculate the length of the members
for _, m := range v.members {
v.length += m.EncodedLen()
}

// pop
valueStack = valueStack[:stackLen-1]
continue
Expand Down Expand Up @@ -122,6 +122,8 @@ func decode(r []byte) (value, error) {
rawContent: v.rawContent[:contentLen],
}
v.members = append(v.members, &cv)

// add a new constructed node to the stack
valueStack = append(valueStack, &cv)
}
v.rawContent = v.rawContent[contentLen:]
Expand Down

0 comments on commit 6cfbd9c

Please sign in to comment.