DPA_InsertPtr (A1)

Paul Rupe prupe at myrealbox.com
Sun Oct 20 11:33:56 CDT 2002


On 20 Oct 2002, dpaun at rogers.com wrote:

> ChangeLog
>   Fix memory corruption introduced by the previous rewrite.
> 
> --- dlls/comctl32/comctl32undoc.c.A0     Sun Oct 20 11:39:48 2002
> +++ dlls/comctl32/comctl32undoc.c     Sun Oct 20 11:40:25 2002
> @@ -1884,7 +1884,7 @@

I was just looking at this same problem.  Should we not also remove the 
line hdpa->nItemCount++?  DPA_SetPtr already does this (which is why we 
needed the -1 you added), so I think we end up incrementing it twice.

For comparison, here's the patch I was about to send (relative to the first 
comctl32undoc.c patch):

License: X11
Changelog:
  Paul Rupe <prupe at myrealbox.com>
  Do not increment nItemCount twice in DPA_InsertPtr


--- comctl32undoc.c.exp	2002-10-20 09:01:42.000000000 -0400
+++ comctl32undoc.c	2002-10-20 12:15:06.000000000 -0400
@@ -1884,9 +1884,9 @@
 
     /* create empty spot at the end */
     if (!DPA_SetPtr(hdpa, hdpa->nItemCount, 0)) return -1;
-    memmove (hdpa->ptrs + i + 1, hdpa->ptrs + i, (hdpa->nItemCount - i) * 
sizeof(LPVOID));
+    memmove (hdpa->ptrs + i + 1, hdpa->ptrs + i,
+             (hdpa->nItemCount - i - 1) * sizeof(LPVOID));
     hdpa->ptrs[i] = p;
-    hdpa->nItemCount++;
     return i;
 }




-- 
Paul Rupe                                        "She smiled, in the end."
p r u p e @ m y r e a l b o x . c o m

| Oppose government police-ware on your PC!
| Stop the Consumer Broadband and Digital Television Promotion Act!
| <http://www.eff.org/alerts/20020322_eff_cbdtpa_alert.html>



More information about the wine-patches mailing list