gdi32: Simplify font->aveWidth sanity-checking to remove possible division by zero.

Dmitry Timoshkov dmitry at baikal.ru
Tue May 7 23:39:56 CDT 2013


Sam Edwards <cfsworks at gmail.com> wrote:

> It makes the most sense to get rid of this sanity check altogether, but 
> until then, this should be a more robust way of doing it.

> +         * TODO: This sounds like a workaround for a much deeper bug involving
> +         * aveWidth's calculation. We should investigate if/why this is needed.
> +         */

This comment is confusing and wrong. There is a test case for which this check
is required.

> +        if (font->aveWidth < 0 || font->aveWidth > font->potm->otmTextMetrics.tmHeight * 100)

A check for an overflow is probably needed. Also a check for negative aveWidth
should be a separate patch at best, and needs a test case.

-- 
Dmitry.



More information about the wine-devel mailing list