Uploaded image for project: 'Xerces-C++'
  1. Xerces-C++
  2. XERCESC-1054

ValueVectorOf::insertElementAt does not ensure capacity

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Resolution: Fixed
    • 2.3.0
    • 2.4.0
    • Utilities
    • None
    • Operating System: All
      Platform: All
    • 24714

    Description

      In ValueVectorOf, it is only checked if the position of the element to be
      inserted is within the range of current elements, but not if there is enough
      capacity to insert the element.

      To reproduce the problem:

      • create ValueVectorOf with initial capacity of 1
      • insertAt(0) will work for the 1st time, as addElement is called
      • next insertAt(0) causes crash in the loop moving element from 0 to 1

      insertAt works in this case, if addElement and removeElement are called before,
      as then space for 1 element is left.

      Calling ensureExtraCapacity(1); before moving the existing elements will solve
      the problem.

      Attachments

        Activity

          People

            Unassigned Unassigned
            werner.bailer@joanneum.at Werner Bailer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: