From 7428d6590a7ae99b78d321d0af6cc7087fda142d Mon Sep 17 00:00:00 2001 From: clay_shooter Date: Sat, 31 Mar 2007 21:48:24 +0000 Subject: [PATCH] SF 1690420 make memcpy calculate buffer length with sizeof() --- docs/ReleaseNotes.html | 25 +++++++++++++++---------- jni/Variant.cpp | 6 +++--- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/docs/ReleaseNotes.html b/docs/ReleaseNotes.html index ca29270..b648a0b 100644 --- a/docs/ReleaseNotes.html +++ b/docs/ReleaseNotes.html @@ -5,7 +5,7 @@

What's New

@@ -16,19 +16,19 @@ 1651926 - (prelease 1) ActiveXComponent: getPropertyAsString should call getString() instead of toString() + (pre-release 1) ActiveXComponent: getPropertyAsString should call getString() instead of toString() 1569864 - (prelease 1) IEnumVariant leak fixed in patch 1674179 + (pre-release 1) IEnumVariant leak fixed in patch 1674179 1112667 - (prelease 1) IEnumVariant leak fixed in patch 1674179 + (pre-release 1) IEnumVariant leak fixed in patch 1674179 1465539 - (prelease 1) IEnumVariant leak fixed in patch 1674179 + (pre-release 1) IEnumVariant leak fixed in patch 1674179   @@ -39,22 +39,27 @@ 1674015 - (prelease 1) ROT hashmap handling when autogc=no (default) can lead to key collisions + (pre-release 1) ROT hashmap handling when autogc=no (default) can lead to key collisions in hashmap. This causes objects to be garbage finalized when they shouldn't be resulting in vm failures with large (large) numbers of objects. 1674179 - (prelease 1) Fixed Enum leaks with EnumVariants in Variant.cpp and EnumVariant.cpp + (pre-release 1) Fixed Enum leaks with EnumVariants in Variant.cpp and EnumVariant.cpp 1687419 - (prelease 3) Corrected calls to AttachCurrentThread in EventProxy + (pre-release 3) Corrected calls to AttachCurrentThread in EventProxy 1689061 - (prelease 4) C code changes to fix VC2003 compiler warnings. + (pre-release 4) C code changes to fix VC2003 compiler warnings. + + 1690420 + (pre-release 4)Incorrect memcpy lengths for Currency Variants + +     @@ -64,7 +69,7 @@ 1662887 - (prelease 1) Dispatch static methods should throw runtime exceptions when + (pre-release 1) Dispatch static methods should throw runtime exceptions when null is passed in for the Dispatch object and when the Dispatch object is in an invalid state. diff --git a/jni/Variant.cpp b/jni/Variant.cpp index 67dae9a..4daae27 100644 --- a/jni/Variant.cpp +++ b/jni/Variant.cpp @@ -656,7 +656,7 @@ JNIEXPORT jlong JNICALL Java_com_jacob_com_Variant_getVariantCurrency CY cy; cy = V_CY(v); jlong jl; - memcpy(&jl, &cy, 8); // was 64. should be sizeof(x) SF 1689061 + memcpy(&jl, &cy, sizeof(jl)); // was 64. should be sizeof(x) SF 1690420 return jl; } return NULL; @@ -683,7 +683,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantCurrencyRef if (v) { VariantClear(v); // whatever was there before CY *pf = (CY *)CoTaskMemAlloc(sizeof(CY)); - memcpy(pf, &cur, 8); // was 64. should be sizeof(x) SF 1689061 + memcpy(pf, &cur, sizeof(*pf)); // was 64. should be sizeof(x) SF 1690420 V_VT(v) = VT_BYREF|VT_CY; V_CYREF(v) = pf; } @@ -795,7 +795,7 @@ JNIEXPORT jlong JNICALL Java_com_jacob_com_Variant_getVariantCurrencyRef CY *cy; cy = V_CYREF(v); jlong jl; - memcpy(&jl, cy, 8); // was 64. should be sizeof(x) SF 1689061 + memcpy(&jl, cy, sizeof(jl)); // was 64. should be sizeof(x) SF 1690420 return jl; } return NULL;