Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential overflow panic #25041

Open
tisonkun opened this issue Jun 3, 2024 · 0 comments · May be fixed by #25123
Open

Potential overflow panic #25041

tisonkun opened this issue Jun 3, 2024 · 0 comments · May be fixed by #25123
Labels

Comments

@tisonkun
Copy link

tisonkun commented Jun 3, 2024

let time_value_nanos = line
.timestamp
.map(|ts| {
let multiplier = match precision {
Precision::Auto => match crate::guess_precision(ts) {
Precision::Second => 1_000_000_000,
Precision::Millisecond => 1_000_000,
Precision::Microsecond => 1_000,
Precision::Nanosecond => 1,
Precision::Auto => unreachable!(),
},
Precision::Second => 1_000_000_000,
Precision::Millisecond => 1_000_000,
Precision::Microsecond => 1_000,
Precision::Nanosecond => 1,
};
ts * multiplier
})
.unwrap_or(ingest_time.timestamp_nanos());

As we noticed at GreptimeTeam/greptimedb#3739 and fixed at GreptimeTeam/greptimedb#3794, L727 can encounter a overflow panic. Properly handle the overflow and return errors can be a better choice.

@hiltontj hiltontj added the v3 label Jun 3, 2024
@LorrensP-2158466 LorrensP-2158466 linked a pull request Jul 2, 2024 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants