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

Fix #12450 #12488

Merged
merged 4 commits into from
Dec 21, 2022
Merged

Fix #12450 #12488

merged 4 commits into from
Dec 21, 2022

Conversation

karimnaaji
Copy link
Contributor

Fix #12450: Infinite loop in zoomFromMercatorZAdjusted.

  • Prevent NaN by gating invalid values from the callee
  • Prevent infinite loop by using a binary search instead of the previous method more prone to floating point comparison issues
  • Add regression tests and new test for this function

Launch Checklist

  • briefly describe the changes in this PR
  • include before/after visuals or gifs if this PR includes visual changes
  • write tests for all new functionality
  • manually test the debug page
  • apply changelog label ('bug', 'feature', 'docs', etc) or use the label 'skip changelog'
  • add an entry inside this element for inclusion in the mapbox-gl-js changelog: <changelog>Fix potential infinite loop when calling fitBounds with globe projection</changelog>

Copy link
Member

@mourner mourner left a comment

Choose a reason for hiding this comment

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

Nice! Binary search 💪

src/geo/transform.js Outdated Show resolved Hide resolved
@karimnaaji karimnaaji merged commit 7bbf2e9 into main Dec 21, 2022
@karimnaaji karimnaaji deleted the karim/12450 branch December 21, 2022 18:08
karimnaaji added a commit that referenced this pull request Jan 3, 2023
…2488)

- Prevent NaN by gating invalid values from the callee
- Prevent infinite loop by using a binary search instead of the previous method more prone to floating point comparison issues
- Add regression tests and new test for this function
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 this pull request may close these issues.

Infinite loop in zoomFromMercatorZAdjusted
2 participants