Juan Lang : wintrust: Correct alignment for 64-bit.

Alexandre Julliard julliard at winehq.org
Mon Aug 10 10:34:52 CDT 2009


Module: wine
Branch: master
Commit: 64b320b7d9b2696f6ab9a22c420cf0cead6a9c2c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=64b320b7d9b2696f6ab9a22c420cf0cead6a9c2c

Author: Juan Lang <juan.lang at gmail.com>
Date:   Fri Aug  7 08:59:12 2009 -0700

wintrust: Correct alignment for 64-bit.

---

 dlls/wintrust/asn.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/wintrust/asn.c b/dlls/wintrust/asn.c
index ec5c4de..002eab5 100644
--- a/dlls/wintrust/asn.c
+++ b/dlls/wintrust/asn.c
@@ -1465,6 +1465,10 @@ struct AsnDecodeSequenceItem
     DWORD                 size;
 };
 
+/* Align up to a DWORD_PTR boundary
+ */
+#define ALIGN_DWORD_PTR(x) (((x) + sizeof(DWORD_PTR) - 1) & ~(sizeof(DWORD_PTR) - 1))
+
 /* Decodes the items in a sequence, where the items are described in items,
  * the encoded data are in pbEncoded with length cbEncoded.  Decodes into
  * pvStructInfo.  nextData is a pointer to the memory location at which the
@@ -1517,9 +1521,7 @@ static BOOL CRYPT_AsnDecodeSequenceItems(DWORD dwCertEncodingType,
                         if (ret)
                         {
                             /* Account for alignment padding */
-                            if (items[i].size % sizeof(DWORD))
-                                items[i].size += sizeof(DWORD) -
-                                 items[i].size % sizeof(DWORD);
+                            items[i].size = ALIGN_DWORD_PTR(items[i].size);
                             TRACE("item %d size: %d\n", i, items[i].size);
                             if (nextData && items[i].hasPointer &&
                              items[i].size > items[i].minSize)




More information about the wine-cvs mailing list