[PATCH] Avoid a divide by zero crash.

Max Woodbury mtewoodbury at gmail.com
Sat Mar 1 03:57:33 CST 2014


On 03/01/2014 04:24 AM, Dmitry Timoshkov wrote:
> Max Woodbury <mtewoodbury at gmail.com> wrote:
>
>> While tmHeight is not _supposed_ to ever be zero, it is an external
>>
>> input and has been found to be zero in a few rare fonts.  Detecting
>>
>> and fixing THAT problem should be handled elsewhere.  This change just
>>
>> keeps the application from being blown away by a divide by zero
>>
>> exception.
>
> This change needs at least more details and preferrably a test case.
>
The test case was submitted about a year ago.

What more details do you think are needed?

tmHeight is an external input, so it can have any value including
zero.  As such, it should NOT be used as a divisor.  This change uses
it as a multiplier on the other side of the comparison so it should not
cause THAT particular problem.  A little additional algebra simplifies
the code.

max



More information about the wine-devel mailing list