[PATCH] conhost: Add the case where the divisor is 0.

Jacek Caban jacek at codeweavers.com
Tue Sep 22 07:12:53 CDT 2020


On 22.09.2020 07:32, Pengpeng Dong wrote:
>           region->Right  = min( x + width, screen_buffer->width ) - 1;
> -        region->Bottom = min( y + entry_cnt / width, screen_buffer->height ) - 1;
> +        if (width)
> +            region->Bottom = min( y + entry_cnt / width, screen_buffer->height ) - 1;
> +        else
> +            region->Bottom = y + (x + i - 1) / screen_buffer->width


Note that in this case region->Right will have a meaningless value. The 
whole case is not really meant to be supported: SMALL_RECT result is 
meant to be used when we write to a region, which can't have 0 width. 
This is already validated on kernelbase side. On conhost side, we could 
probably return STATUS_INVALID_PARAMETER in this case.


Thanks,

Jacek




More information about the wine-devel mailing list