Skip to content

Handle empty indefinite-length objects in BER2DER - #176

Open
JakeHuneau wants to merge 1 commit into
github:mainfrom
JakeHuneau:ber2der-empty-indefinite
Open

JakeHuneau wants to merge 1 commit into
github:mainfrom
JakeHuneau:ber2der-empty-indefinite

Conversation

@JakeHuneau

@JakeHuneau JakeHuneau commented Oct 27, 2026 •

Copy link
Copy Markdown

Fixes #103

readObject read a child before checking for the end-of-contents octets, so an empty indefinite-length SEQUENCE or SET (30 80 00 00) failed with "Invalid BER format". As suggested in the issue, this checks for the terminator before reading each child. Non-empty objects are handled the same as before.

Added TestBer2Der_EmptyIndefinite, covering an empty SEQUENCE and an empty SET followed by a sibling. Both cases fail without the change. go test -vet=off ./ietf-cms/... passes. (With Go 1.27, vet flags an existing non-constant format string in ietf-cms/verify_test.go:257, unrelated to this change.)

readObject read a child object before checking for the end-of-contents octets, so an empty indefinite-length SEQUENCE or SET (30 80 00 00) failed with "Invalid BER format". Check for the terminator before reading each child.

Fixes github#103
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

protocol: BER2DER does not handle empty indefinite length objects

1 participant