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

Division by zero in findHoleBridge #48

Closed
springmeyer opened this issue Jan 13, 2017 · 0 comments · Fixed by #50
Closed

Division by zero in findHoleBridge #48

springmeyer opened this issue Jan 13, 2017 · 0 comments · Fixed by #50
Assignees

Comments

@springmeyer
Copy link
Contributor

springmeyer commented Jan 13, 2017

Division by zero in C++ may cause an unrecoverable crash and needs to be avoided. The -fsanitize=undefined in clang++ 3.9.1 spotted a case where division by zero happens in findHoleBridge during the mbgl unit tests because p->next->y - p->y == 0:

double x = p->x + (hy - p->y) * (p->next->x - p->x) / (p->next->y - p->y);

/cc @mourner

refs mapbox/mapbox-gl-native#5379

@mourner mourner self-assigned this Jan 13, 2017
mrgreywater added a commit to mrgreywater/earcut.hpp that referenced this issue Jan 13, 2017
mrgreywater added a commit to mrgreywater/earcut.hpp that referenced this issue Jan 13, 2017
mrgreywater added a commit to mrgreywater/earcut.hpp that referenced this issue Jan 13, 2017
mrgreywater added a commit to mrgreywater/earcut.hpp that referenced this issue Jan 13, 2017
mrgreywater added a commit to mrgreywater/earcut.hpp that referenced this issue Jan 13, 2017
mrgreywater added a commit to mrgreywater/earcut.hpp that referenced this issue Jan 13, 2017
mourner pushed a commit that referenced this issue Jan 13, 2017
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 a pull request may close this issue.

2 participants