-
Notifications
You must be signed in to change notification settings - Fork 199
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
Don't panic on negative epsilon #537
Conversation
dc6e803
to
d5d7a25
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
your last commit looks good! but there are also some other commits in here!
🤦♂️ |
d5d7a25
to
e2465c7
Compare
@@ -19,6 +19,10 @@ fn rdp<T>(points: &[Point<T>], epsilon: &T) -> Vec<Point<T>> | |||
where | |||
T: Float, | |||
{ | |||
// Epsilon must be greater than zero for any meaningful simplification to happen | |||
if *epsilon <= T::zero() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implies some kind of programmer error right? Should we add a debug assertion failure here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming the fuzzer runs against release builds and thus won't trigger the debug assertion? But I might be wrong...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cargo-fuzz builds in release mode with debug assertions
i don't know where the default value for debug-assertions gets set in cargo-fuzz, but i verified locally that debug assertions are enabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I don't feel confident about how to resolve this.
I can imagine some cases where it would be interesting if it were possible to reach an assert via the fuzzer, and others, like here, where it wouldn't be interesting.
We could have the convention that debug_assert
is the former while assert
is the latter, but... that seems pretty limiting.
We could make our own assert macros, like debug_assert_unless_fuzzing!
, but that seems a bit much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To restate, I'm really OK with just merging this as is. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am feeling very indecisive too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to merging as-is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Feedback was optional, so take it or leave it.
@@ -19,6 +19,10 @@ fn rdp<T>(points: &[Point<T>], epsilon: &T) -> Vec<Point<T>> | |||
where | |||
T: Float, | |||
{ | |||
// Epsilon must be greater than zero for any meaningful simplification to happen | |||
if *epsilon <= T::zero() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to merging as-is
bors r+ |
Build succeeded: |
Fixes #536