cppcheck: arrayIndexOutOfBounds report in stortree.cxx (store module)
julien2412
serval2412 at yahoo.fr
Sat Jan 17 06:49:10 PST 2015
Hello,
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;
53 }
See http://opengrok.libreoffice.org/xref/core/store/source/stortree.cxx#51
Should line 51 be replaced by:
for (sal_uInt16 i = 0; i < n; i++)
or is it this way for a good reason?
Any idea?
Julien
--
View this message in context: http://nabble.documentfoundation.org/cppcheck-arrayIndexOutOfBounds-report-in-stortree-cxx-store-module-tp4136432.html
Sent from the Dev mailing list archive at Nabble.com.
More information about the LibreOffice
mailing list