Skip to content
  • Alexander Larsson's avatar
    Avoid integer overflow in gdk_rectangle_intersect · 3c618f2f
    Alexander Larsson authored
    If e.g. the right edge of the leftmost rectangle is near MIN_INT, and
    the left edge of the rightmost rectangle is large then subtracting these
    can lead to an integer overflow, making the resultant "width" falsely
    positive, thus returning a very wide result instead of the expected
    no-intersection result.
    
    We avoid the overflow by not doing the subtraction unless we know the
    result will be positive. There are still risks for overflow if x + width
    or y + width is larger than MAXINT, but we won't ever overflow for valid
    rects now.
    
    This may fix #607687
    3c618f2f