RICHED20: WM_GETTEXT should return 0 on overflow but fill buffer anyway

Alex Villací­s Lasso a_villacis at palosanto.com
Thu Dec 6 09:50:48 CST 2007


Also spotted while trying to fix bug #10577.

Test show that in case of overflow, WM_GETTEXT will fill the entirety of 
the output buffer, up to the declared size in bytes, without writing a 
trailing null character. In addition, it will return 0, but fill the 
buffer anyway. Unlike EM_GETTEXTEX, WM_GETTEXT does truncate any 
trailing CRLF and leaves a solitary CR in case of overflow.

Please apply after the patch that corrects the EM_GETTEXTEX behavior, as 
this patch depends on it.

Changelog:
* WM_GETTEXT on riched20 returns 0 in case of overflow, but fills buffer 
anyway.
* In case of overflow, WM_GETTEXT on riched20 fills the entire buffer 
and does *not* place a trailing null character anywhere.
* In case of overflow, WM_GETTEXT is willing to truncate CRLF into CR, 
unlike EM_GETTEXTEX + GT_USECRLF.
* Tests for all of the above.

-- 
perl -e '$x=2.4;print sprintf("%.0f + %.0f = %.0f\n",$x,$x,$x+$x);'

-------------- next part --------------
A non-text attachment was scrubbed...
Name: wine-riched20-WM_GETTEXT-return-zero-on-overflow.patch
Type: text/x-patch
Size: 3689 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20071206/5f0e9544/attachment.bin 


More information about the wine-patches mailing list