crypt32: Re: exception handling, part 2

Saulius Krasuckas saulius2 at ar.fi.lt
Fri Jul 22 05:57:51 CDT 2005


* Log message from [1]:
> 
> 	Juan Lang <juan_lang at yahoo.com>
> 	- fix decoding of long-form data lengths
> 	- use exception handling in decoding
> 	- tests for these changes

One of added tests in the patch fails on winME:

| encode.c:313: Test failed: Expected CRYPT_E_ASN1_LARGE, got c0000005

But the bad thing is that after running small code chunk another calls to 
CryptEncodeObjectEx() starts generating exceptions here.  Mentioned code:

+    /* Try to decode some bogus large items */
+    /* The buffer size is smaller than the encoded length, so this should fail
+     * with CRYPT_E_ASN1_EOD if it's being decoded.  It's failing with
+     * CRYPT_E_ASN1_LARGE, meaning there's a limit on the size decoded.
+     * The magic limit under XP seems to be 0x061a8000 bytes--more than this
+     * fails with CRYPT_E_ASN1_LARGE.
+     */
+    ret = CryptDecodeObjectEx(dwEncoding, X509_MULTI_BYTE_INTEGER, tooBig,
+     0x7fffffff, CRYPT_DECODE_ALLOC_FLAG, NULL, (BYTE *)&buf, &bufSize);
+    ok(!ret && GetLastError() == CRYPT_E_ASN1_LARGE,
+     "Expected CRYPT_E_ASN1_LARGE, got %08lx\n", GetLastError());

And example of parameters for the mentioned call (which after throws an 
exception of "Access violation" in another tests):

CryptEncodeObjectEx(
  X509_ASN_ENCODING, 
  X509_ENUMERATED, 
  1, 
  CRYPT_ENCODE_ALLOC_FLAG, 
  NULL, 
  (BYTE *)&buf, 
  &bufSize
);

HTH to fix exceptions.  If that informations is not enough, I will be glad 
to debug this via e-mail, Juan. :-)


[1] http://www.winehq.org/hypermail/wine-cvs/2005/06/0683.html



More information about the wine-devel mailing list