riched20: Prevent setting an invalid default format rect

Thomas Faber thfabba at
Sat Oct 15 05:10:57 CDT 2011

Many applications (e.g. mIRC 7.19) create richedit controls with zero or
almost-zero width/height. The ME_SetDefaultFormatRect function does not
take this into account when calculating the format rect, and will create
and invalid rectangle (left > right or similar) in this case, which is
then be passed on to several other functions, and results in negative
values for "available width" fields considered when doing wrapping
This will for instance lead to an assertion failure when Wine's
riched20.dll is used on Windows [1].

The patch fixes this by adding checks to ME_SetDefaultFormatRect to
use the minimal rectangle that is still valid in this case.


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-riched20-Prevent-setting-an-invalid-default-format-r.patch
URL: <>

More information about the wine-patches mailing list