On 01/17/2015 03:49 PM, julien2412 wrote:
Cppcheck reported this: <error file="store/source/stortree.cxx" line="52" id="arrayIndexOutOfBounds" severity="error" msg="Array 'm_pData[1]' accessed at index 1, which is out of bounds."/>41 OStoreBTreeNodeData::OStoreBTreeNodeData (sal_uInt16 nPageSize) 42 : OStorePageData (nPageSize) 43 { 44 base::m_aGuard.m_nMagic = store::htonl(self::theTypeId); 45 base::m_aDescr.m_nUsed = store::htons(self::thePageSize); // usageCount(0) 46 self::m_aGuard.m_nMagic = store::htonl(0); // depth(0) 47 48 sal_uInt16 const n = capacityCount(); 49 T const t; 50 51 for (sal_uInt16 i = 1; i < n; i++) 52 m_pData[i] = t;
That m_pData is a "flexible array member" whose actual length is controlled dynamically. Cppcheck could probably make use of a heuristic to treat a trailing member declared as an array of length 1 as such a flexible array, as do some other static analysis tools.
_______________________________________________ LibreOffice mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice
