Skip to content

fix: handle long fractional Unix timestamps#4934

Open
immanuwell wants to merge 1 commit into
containerd:mainfrom
immanuwell:fix-long-fractional-timestamps
Open

fix: handle long fractional Unix timestamps#4934
immanuwell wants to merge 1 commit into
containerd:mainfrom
immanuwell:fix-long-fractional-timestamps

Conversation

@immanuwell
Copy link
Copy Markdown
Contributor

Tiny parser fix. Before this, a Unix timestamp with a long fractional part got validated before truncation, so it could overflow int64 and fail. Kinda annoying, but real: logs --since/--until feed user timestamp strings through this path.

Repro before the fix:

go test ./pkg/timestamp

with 1136073600.123456789123456789123, it errors with value out of range instead of truncating to 9 ns digits.

Now the parser truncates first, then parses. Existing short fractions still work.

Checked:

go test ./pkg/timestamp
go test ./pkg/...
git diff --check origin/main..HEAD

Signed-off-by: immanuwell <pchpr.00@list.ru>
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