Skip to content

Commit

Permalink
fix integer overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ScorrMorr authored and KJeff01 committed May 17, 2019
1 parent cac83e9 commit 43a34a8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/geometry.cpp
Expand Up @@ -102,8 +102,8 @@ bool inQuad(const Vector2i *pt, const QUAD *quad)
{
Vector2i edge = quad->coords[j] - quad->coords[i];
Vector2i pos = *pt - quad->coords[i];
if ((0 <= pos.y && pos.y < edge.y && pos.x * edge.y < pos.y * edge.x) ||
(edge.y <= pos.y && pos.y < 0 && pos.x * edge.y > pos.y * edge.x))
if ((0 <= pos.y && pos.y < edge.y && (int64_t)pos.x * (int64_t)edge.y < (int64_t)pos.y * (int64_t)edge.x) ||
(edge.y <= pos.y && pos.y < 0 && (int64_t)pos.x * (int64_t)edge.y > (int64_t)pos.y * (int64_t)edge.x))
{
c = !c;
}
Expand Down

0 comments on commit 43a34a8

Please sign in to comment.