[PATCH v2 2/2] rsaenh: Properly destroy hashes created by CPCreateHash() (Valgrind).

Alexandre Julliard julliard at winehq.org
Mon Feb 14 14:15:40 CST 2022


Sven Baars <sbaars at codeweavers.com> writes:

> Signed-off-by: Sven Baars <sbaars at codeweavers.com>
> ---
>  dlls/rsaenh/rsaenh.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)

This breaks the tests:

tools/runtest -q -P wine -T . -M crypt32.dll -p dlls/crypt32/tests/crypt32_test.exe cert && touch dlls/crypt32/tests/cert.ok
wine: Unhandled page fault on write access to 00000004 at address 7BC25526 (thread 0178), starting debugger...
Unhandled exception: page fault on write access to 0x00000004 in 32-bit code (0x7bc25526).
Register dump:
 CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b
 EIP:7bc25526 ESP:0031f710 EBP:0031f728 EFLAGS:00010202(  R- --  I   - - - )
 EAX:01120f68 EBX:01120048 ECX:00000a98 EDX:011204d0
 ESI:00000000 EDI:00000000
Stack dump:
0x0031f710:  01120094 00000002 01120f68 01120048
0x0031f720:  011204e8 011204f0 0031f768 7bc25fb4
0x0031f730:  01120094 00000002 01120000 00000000
0x0031f740:  00000000 01120048 0031f788 01120000
0x0031f750:  01120000 00000a98 0031f7c8 01120000
0x0031f760:  01120000 011204e8 0031f7c8 7bc2683c
Backtrace:
=>0 0x7bc25526 list_remove+0x6(elem=<internal error>) [Z:\home\julliard\wine\wine\include\wine\list.h:100] in ntdll (0x0031f728)
  1 0x7bc25526 HEAP_CreateFreeBlock+0x126(subheap=<register EBX not accessible in this frame>, ptr=<register EDX not accessible in this frame>, size=<register ECX not accessible in this frame>) [Z:\home\julliard\wine\wine\dlls\ntdll\heap.c:492] in ntdll (0x0031f728)
  2 0x7bc25fb4 HEAP_MakeInUseBlockFree+0xe4(subheap=<register EBX not accessible in this frame>, pArena=<is not available>) [Z:\home\julliard\wine\wine\dlls\ntdll\heap.c:666] in ntdll (0x0031f768)
  3 0x7bc2683c RtlFreeHeap+0x67(heap=<internal error>, flags=<internal error>, ptr=<internal error>) [Z:\home\julliard\wine\wine\dlls\ntdll\heap.c:1769] in ntdll (0x0031f7c8)
  4 0x7bc27b3a RtlFreeHeap+0x35(heap=<internal error>, flags=<internal error>, ptr=<internal error>) [Z:\home\julliard\wine\wine\dlls\ntdll\heap.c:1744] in ntdll (0x0031f808)
  5 0x70b74b93 msvcrt_heap_free+0x4b(ptr=<internal error>) [Z:\home\julliard\wine\wine\dlls\msvcrt\heap.c:114] in ucrtbase (0x0031f838)
  6 0x70b74b93 free+0x5e(ptr=<internal error>) [Z:\home\julliard\wine\wine\dlls\msvcrt\heap.c:413] in ucrtbase (0x0031f838)
  7 0x66244676 BCryptDestroyHash+0x36(handle=011204F0) [Z:\home\julliard\wine\wine\dlls\bcrypt\bcrypt_main.c:894] in bcrypt (0x0031f878)
  8 0x6fe4c56b destroy_hash+0x1b(pObject=006126C8) [Z:\home\julliard\wine\wine\dlls\rsaenh\rsaenh.c:605] in rsaenh (0x0031f8b8)
  9 0x6fe42ad2 release_handle+0x92(lpTable=6FE6F000, handle=0x2, dwType=0x85938417) [Z:\home\julliard\wine\wine\dlls\rsaenh\handle.c:245] in rsaenh (0x0031f908)
  10 0x6fe4d28b RSAENH_CPDestroyHash+0x6b(hProv=0x1, hHash=0x2) [Z:\home\julliard\wine\wine\dlls\rsaenh\rsaenh.c:2289] in rsaenh (0x0031f938)
  11 0x6174f76b CryptDestroyHash+0x7b(hHash=<internal error>) [Z:\home\julliard\wine\wine\dlls\advapi32\crypt.c:889] in advapi32 (0x0031f978)
  12 0x6e8c7e32 CryptHashCertificate+0x142(hCryptProv=<internal error>, Algid=<internal error>, dwFlags=<internal error>, pbEncoded=<internal error>, cbEncoded=<internal error>, pbComputedHash=<internal error>, pcbComputedHash=<internal error>) [Z:\home\julliard\wine\wine\dlls\crypt32\cert.c:2263] in crypt32 (0x0031f9f8)
  13 0x6e8c8a15 CertContext_GetHashProp+0x35(pcbData=<internal error>, pvData=<internal error>, toHashLen=<internal error>, toHash=<internal error>, algID=<internal error>, dwPropId=<internal error>, cert=<internal error>) [Z:\home\julliard\wine\wine\dlls\crypt32\cert.c:398] in crypt32 (0x0031fa68)
  14 0x6e8c8a15 CertContext_GetProperty+0x4a5(cert=<register EBX not accessible in this frame>, dwPropId=<internal error>, pvData=<register ESI not accessible in this frame>, pcbData=0031FB20) [Z:\home\julliard\wine\wine\dlls\crypt32\cert.c:579] in crypt32 (0x0031fa68)
  15 0x6e8c8b0f CertGetCertificateContextProperty+0x4f(pCertContext=<internal error>, dwPropId=<internal error>, pvData=<internal error>, pcbData=<internal error>) [Z:\home\julliard\wine\wine\dlls\crypt32\cert.c:654] in crypt32 (0x0031fac8)
  16 0x6e8c8d9e add_cert_to_store+0x4e(store=<register ESI not accessible in this frame>, cert=<register EBX not accessible in this frame>, add_disposition=<register EDI not accessible in this frame>, use_link=0, ret_context=0031FC0C) [Z:\home\julliard\wine\wine\dlls\crypt32\cert.c:193] in crypt32 (0x0031fb58)
  17 0x6e8c93d9 CertAddCertificateContextToStore+0x1a(ppStoreContext=<internal error>, dwAddDisposition=<internal error>, pCertContext=<internal error>, hCertStore=<internal error>) [Z:\home\julliard\wine\wine\dlls\crypt32\cert.c:290] in crypt32 (0x0031fbb8)
  18 0x6e8c93d9 CertAddEncodedCertificateToStore+0x79(hCertStore=<internal error>, dwCertEncodingType=<internal error>, pbCertEncoded=<internal error>, cbCertEncoded=<internal error>, dwAddDisposition=<internal error>, ppCertContext=<internal error>) [Z:\home\julliard\wine\wine\dlls\crypt32\cert.c:65] in crypt32 (0x0031fbb8)
  19 0x00407dbe testGetSubjectCert+0x13e() [Z:\home\julliard\wine\wine\dlls\crypt32\tests\cert.c:1382] in crypt32_test (0x0031fc98)
  20 0x00411106 func_cert+0x36() [Z:\home\julliard\wine\wine\dlls\crypt32\tests\cert.c:4336] in crypt32_test (0x0031fe08)
  21 0x0046626b run_test+0xe6(name=<internal error>) [Z:\home\julliard\wine\wine\include\wine\test.h:614] in crypt32_test (0x0031fee8)
  22 0x0046626b main+0x26b(argc=<internal error>, argv=<internal error>) [Z:\home\julliard\wine\wine\include\wine\test.h:697] in crypt32_test (0x0031fee8)
  23 0x00465f7f mainCRTStartup+0x7f() [Z:\home\julliard\wine\wine\dlls\msvcrt\crt_main.c:60] in crypt32_test (0x0031ff30)
  24 0x7b62de90 WriteTapemark+0x100(device=7FFD1000, type=<is not available>, count=<is not available>, immediate=<is not available>) [Z:\home\julliard\wine\wine\dlls\kernel32\tape.c:317] in kernel32 (0x0031ff48)
  25 0x7bc57c27 RtlWakeConditionVariable+0x57(variable=7B62DE80) [Z:\home\julliard\wine\wine\dlls\ntdll\sync.c:766] in ntdll (0x0031ff5c)
  26 0x7bc582e0 RtlCreateUserThread(entry=00465F00, arg=7FFD1000) [Z:\home\julliard\wine\wine\dlls\ntdll\thread.c:261] in ntdll (0x0031ffec)
0x7bc25526 HEAP_CreateFreeBlock+0x126 [Z:\home\julliard\wine\wine\dlls\ntdll\heap.c:492] in ntdll: movl	%esi,0x4(%edi)
492	    pArena->size |= ARENA_FLAG_FREE;

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list