Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index


Hello,

Cppcheck reported this:
    <error file="store/source/stortree.cxx" line="52"
id="arrayIndexOutOfBounds" severity="error" msg="Array
&apos;m_pData[1]&apos; 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.

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.