Skip to content

Commit

Permalink
Fix unsigned overflow.
Browse files Browse the repository at this point in the history
I'm not sure what exactly causes it, but there are some cases where
assImage->dst_x/y will be set when there is nothing to render, which
results in bad behavior.
  • Loading branch information
torque committed Nov 26, 2014
1 parent 73c3e74 commit 50c5ac6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ASSInspector.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ int assi_calculateBounds( ASSI_State *state, ASSI_Rect *rects, const int32_t *ti
}
assImage = assImage->next;
}

boundsRect.x2 = (boundsRect.x2 < boundsRect.x1)? boundsRect.x1: boundsRect.x2;
boundsRect.y2 = (boundsRect.y2 < boundsRect.y1)? boundsRect.y1: boundsRect.y2;

rects[i].x = boundsRect.x1;
rects[i].y = boundsRect.y1;
rects[i].w = boundsRect.x2 - boundsRect.x1;
Expand Down

0 comments on commit 50c5ac6

Please sign in to comment.