summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-10-19 17:22:42 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-10-20 19:53:27 +0200
commitc2b33fec70f0f4c79584db119ecd565af3a5b28e (patch)
treec2e18d16ab23e71ddb19bc79be6db787765feafd
parent0b8682d83e9e5a9832383aff011af5429ddd7e71 (diff)
pvs-studio: 'memcpy' function will lead to underflow of the buffer
Change-Id: I285d5ddcc8906d1e38c6b58c625dc7c894ad433a Reviewed-on: https://gerrit.libreoffice.org/62064 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--winaccessibility/source/UAccCOM/MAccessible.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx b/winaccessibility/source/UAccCOM/MAccessible.cxx
index 0a75d9a4e5a8..1801cf61929e 100644
--- a/winaccessibility/source/UAccCOM/MAccessible.cxx
+++ b/winaccessibility/source/UAccCOM/MAccessible.cxx
@@ -2898,10 +2898,13 @@ void CMAccessible::ConvertAnyToVariant(const css::uno::Any &rAnyVal, VARIANT *pv
break;
case TypeClass_BOOLEAN:
+ {
+ bool bBoolean(false);
+ rAnyVal >>= bBoolean;
pvData->vt = VT_BOOL;
- memcpy(&pvData->boolVal, rAnyVal.getValue(), sizeof(sal_Bool));
+ pvData->boolVal = bBoolean; // boolVal is a VARIANT_BOOL, a 16bit field
break;
-
+ }
case TypeClass_BYTE:
pvData->vt = VT_UI1;
memcpy(&pvData->bVal, rAnyVal.getValue(), sizeof(sal_Int8));