[PATCH] wintrust: Verify array length before calling memcmp in test (valgrind).

Roy Shea royshea at gmail.com
Thu Jun 19 10:54:50 CDT 2008


Dan Kegel noted that prior version of this patch:

http://www.winehq.org/pipermail/wine-patches/2008-June/056085.html

fails to prevent the memcmp from executing and provided the attached
revision.  The patch description remains the same and is included below
for easy reference:

Call to memcmp in test_calchash assumes length of hash and expectedhash
are the same.  This need not be true in general, and is not true for the
current stub implementation of CryptCATAdminCalcHashFromFileHandle.
This patch adds an explicit test of array length.  In doing so it
prevents the following Valgrind warning:

Conditional jump or move depends on uninitialised value(s)
   at  winetest_vok (test.h:256)
   by  winetest_ok (test.h:301)
   by  test_calchash (crypt.c:338)
   by  func_crypt (crypt.c:359)
   by  run_test (test.h:449)

Note that the Valgrind warning listed above is a "heisenbug" that is
only occasionally detected by Valgrind.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wintrust-crypt-hashlen.patch
Type: text/x-patch
Size: 1537 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20080619/b4d4ab4e/attachment.bin 


More information about the wine-patches mailing list