Skip to content

fix(ttlv): parse DateTime hex values with base 16 instead of base 10#96

Open
phsym wants to merge 1 commit intomainfrom
fix/datetime-hex-parsing
Open

fix(ttlv): parse DateTime hex values with base 16 instead of base 10#96
phsym wants to merge 1 commit intomainfrom
fix/datetime-hex-parsing

Conversation

@phsym
Copy link
Copy Markdown
Collaborator

@phsym phsym commented Apr 17, 2026

Summary

  • Fix strconv.ParseUint base parameter in DateTime JSON decoder: 0x-prefixed values were parsed with base 10 instead of base 16, causing any value containing hex digits (a-f) to fail
  • Add test case for hex-encoded DateTime decoding

The DateTime JSON decoder used strconv.ParseUint with base 10 when
parsing 0x-prefixed values, causing hex digits (a-f) to fail parsing.
@phsym phsym requested a review from a team as a code owner April 17, 2026 09:50
@phsym phsym requested a review from Copilot April 17, 2026 20:41
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes JSON DateTime decoding for 0x-prefixed epoch values by parsing the numeric portion as hexadecimal (base 16), and adds a regression test to ensure hex-encoded DateTime values decode correctly.

Changes:

  • Parse 0x-prefixed DateTime values with strconv.ParseUint(..., 16, 64) instead of base 10.
  • Add a decoding test covering hex-encoded DateTime values.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
ttlv/encoding_json.go Corrects base used when parsing 0x-prefixed DateTime values in the JSON reader.
ttlv/encoding_json_test.go Adds a regression test validating hex DateTime decoding.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ttlv/encoding_json.go
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.

2 participants