Alexandre Julliard : gdi32: Avoid overflows for invalid coordinates in line clipping.

Alexandre Julliard julliard at winehq.org
Wed Feb 22 16:24:59 CST 2012


Charles Davis <cdavis at mymail.mines.edu> writes:

> On Feb 22, 2012, at 1:27 PM, Alexandre Julliard wrote:
>> --- a/dlls/gdi32/dibdrv/objects.c
>> +++ b/dlls/gdi32/dibdrv/objects.c
>> @@ -372,7 +372,8 @@ static inline DWORD calc_outcode(const POINT *pt, const RECT *clip)
>> int clip_line(const POINT *start, const POINT *end, const RECT *clip,
>>               const bres_params *params, POINT *pt1, POINT *pt2)
>> {
>> -    int m, n;
>> +
>> +    INT64 m, n;  /* 64-bit to avoid overflows (FIXME: find a more efficient way) */

> What about MulDiv()? As I recall, this is the sort of situation for
> which it was designed. Or is that not efficient?

It could possibly be made to work, but MulDiv's rounding is different,
and adding the bias would be more complicated.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list