From 775bf0c7d973226cad13c0e54ad384ae4e905041 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 10 Feb 2017 11:23:51 +0000 Subject: test coverity sanitizing in-source modelling Change-Id: I31b1f021c414b26372c07a28c235bedb3e5a2b32 --- registry/source/reflread.cxx | 7 +++++++ unoidl/source/unoidlprovider.cxx | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/registry/source/reflread.cxx b/registry/source/reflread.cxx index 97699af8e824..d54a3098d6a7 100644 --- a/registry/source/reflread.cxx +++ b/registry/source/reflread.cxx @@ -1020,6 +1020,10 @@ RTParamMode MethodList::getMethodParamMode(sal_uInt16 index, sal_uInt16 paramInd return aMode; } +#if defined(__COVERITY__) +extern "C" void __coverity_tainted_data_sanitize__(void *); +#endif + sal_uInt16 MethodList::getMethodExcCount(sal_uInt16 index) { sal_uInt16 aCount = 0; @@ -1028,6 +1032,9 @@ sal_uInt16 MethodList::getMethodExcCount(sal_uInt16 index) { try { aCount = readUINT16(m_pIndex[index] + calcMethodParamIndex(readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT))); +#if defined(__COVERITY__) + __coverity_tainted_data_sanitize__(&aCount); +#endif } catch (BlopObject::BoundsError &) { SAL_WARN("registry", "bad data"); } diff --git a/unoidl/source/unoidlprovider.cxx b/unoidl/source/unoidlprovider.cxx index ea15ff5a119a..47e59bfc82db 100644 --- a/unoidl/source/unoidlprovider.cxx +++ b/unoidl/source/unoidlprovider.cxx @@ -531,6 +531,10 @@ sal_uInt32 findInMap( return off; } +#if defined(__COVERITY__) +extern "C" void __coverity_tainted_data_sanitize__(void *); +#endif + std::vector< OUString > readAnnotations( bool annotated, rtl::Reference< MappedFile > const & file, sal_uInt32 offset, sal_uInt32 * newOffset = nullptr) @@ -538,6 +542,9 @@ std::vector< OUString > readAnnotations( std::vector< OUString > ans; if (annotated) { sal_uInt32 n = file->read32(offset); +#if defined(__COVERITY__) + __coverity_tainted_data_sanitize__(&n); +#endif offset += 4; for (sal_uInt32 i = 0; i != n; ++i) { ans.push_back(file->readIdxString(&offset)); -- cgit