From c2b33fec70f0f4c79584db119ecd565af3a5b28e Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 19 Oct 2018 17:22:42 +0100 Subject: pvs-studio: 'memcpy' function will lead to underflow of the buffer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I285d5ddcc8906d1e38c6b58c625dc7c894ad433a Reviewed-on: https://gerrit.libreoffice.org/62064 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- winaccessibility/source/UAccCOM/MAccessible.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'winaccessibility') 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)); -- cgit