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

Possible Incompleteness #3697

Closed
YichiZhang0613 opened this issue Feb 27, 2024 · 1 comment · Fixed by #3699
Closed

Possible Incompleteness #3697

YichiZhang0613 opened this issue Feb 27, 2024 · 1 comment · Fixed by #3699
Labels
bug Something isn't working

Comments

@YichiZhang0613
Copy link

In boa/core/engine/src/value/integer.rs, I think the code should check min<=max before calling clamp comments mentioned to avoid unnecessary panic.

/// # Panics
    ///
    /// Panics if `min > max`.
    #[must_use]
    pub fn clamp_finite(self, min: i64, max: i64) -> i64 {
        match self {
            Self::Integer(i) => i.clamp(min, max),
            Self::PositiveInfinity => max,
            Self::NegativeInfinity => min,
        }
    }
@YichiZhang0613 YichiZhang0613 added the bug Something isn't working label Feb 27, 2024
@jedel1043
Copy link
Member

Good catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants