Modify

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#4950 closed defect (fixed)

Bad loop over attribute list

Reported by: anonymous Owned by: team
Priority: normal Component: Core
Version: latest Keywords: gcj
Cc:

Description

file :src/org/openstreetmap/josm/io/OsmApi.java

line 124: for (int i=0; i< qName.length(); i++) {

it loops over the chars in the string to get the attributes, this causes an out of bounds error.

the code should be :

for (int i=0; i< atts.getLength(); i++) {

see my code changes here :
http://github.com/h4ck3rm1k3/josm/commit/63901da2138bc050e39fbc7c0277163396f6e73c

error message :
Caused by: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
at java.util.ArrayList.raiseBoundsError(libgcj.so.10)
at java.util.ArrayList.checkBoundExclusive(libgcj.so.10)
at java.util.ArrayList.get(libgcj.so.10)
at gnu.xml.stream.XMLParser.getAttributeName(libgcj.so.10)
at gnu.xml.stream.SAXParser.getQName(libgcj.so.10)
at org.openstreetmap.josm.io.OsmApi$CapabilitiesParser.startElement(josm)
at gnu.xml.stream.SAXParser.parse(libgcj.so.10)

This is why we should be testing with the gcj because it catches such sloppy code.

Attachments (0)

Change History (2)

comment:1 Changed 3 years ago by bastiK

  • Resolution set to fixed
  • Status changed from new to closed

(In [3212]) fixed #4950 - Bad loop over attribute list (patch by jamesmikedupont)

comment:2 Changed 3 years ago by stoecker

Ticket #4804 has been marked as a duplicate of this ticket.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed .
as The resolution will be set. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.