gdi32: Simplify font->aveWidth sanity-checking to fix possible division by zero. (try 2)

Sam Edwards cfsworks at gmail.com
Wed May 8 04:45:48 CDT 2013


After feedback from Dmitry (thanks!), I redid this patch with the 
following changes:

* I misunderstood before what the test did; I initially thought this was 
just a workaround to get aveWidth to behave, but as it turns out, 
Windows has the same "maximum ratio of 100" limit. I changed the comment 
to reflect that; hopefully this stops someone else from making my 
mistake. :)
* Negative aveWidth checking is removed. I agree that there should be a 
test to put this in, but Windows treats negative aveWidths as invalid 
(according to Aric), so it can't be tested on Windows. That's a much 
bigger mess than a simple "fix divide by zero" patch is worth.
* The division is done differently, to avoid potential overflow 
problems. The result of the comparison is still exactly the same as 
before the patch, except zero values are now handled gracefully.

This supersedes 96111 (which, I forgot to mention before, supersedes 
96053 and 96047).

Best,
Sam
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-gdi32-Simplify-font-aveWidth-sanity-checking-to-fix-.patch
Type: text/x-patch
Size: 1532 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20130508/45cdfa95/attachment.bin>


More information about the wine-patches mailing list