[PATCH 2/2] msvcr90/tests: Added qsort_s tests. (try 6)

Vincas Miliūnas vincas.miliunas at gmail.com
Wed Nov 17 10:07:58 CST 2010

* Used qsort implementation from ntdll as the base instead the one from git.

* The tests should check for errno values, but the only way I could access the real errno (qsort_s returns void) was by GetProcAddress'ing _get_errno/_set_errno functions (this isn't included in the patch). The errno variable itself was unaffected by msvcr90 calls and maps to somethings other that the errno used by the VC runtime. The issue is present in all of the testbot VMs.

* NTDLL_qsort has a multiplication overflow (nmemb*size) issue. This qsort_s implementation does a subsequent division to check for an overflow (it also doesn't directly require 128bit variables in 64bit mode). The reaction to an overflow is to set errno to EINVAL and return without touching the data.
Given overflow values, Windows implementation in one case returns without side effects (test case is included in the patch), in others crashes.

 dlls/msvcr90/tests/msvcr90.c |  134 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 134 insertions(+), 0 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-msvcr90-tests-Added-qsort_s-tests.-try-6.patch
Type: text/x-patch
Size: 7450 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20101117/ef6f9bb7/attachment.bin>

More information about the wine-patches mailing list