frizbog / gedcom4j

Java library for reading/writing genealogy files in GEDCOM format
http://gedcom4j.org
53 stars 36 forks source link

Crash when reading line #184

Open haralduna opened 7 years ago

haralduna commented 7 years ago

java.lang.ArrayIndexOutOfBoundsException: at org.gedcom4j.io.reader.AnselReader.nextLine(AnselReader.java:151) at org.gedcom4j.io.reader.GedcomFileReader.nextLine(GedcomFileReader.java:120) at org.gedcom4j.parser.GedcomParser.load(GedcomParser.java:325)

151: holdingBin[holdingBinIdx++] = (char) twoCharsBack;

The holdingBin array has a size of two, and the code clearly allows the index to take a value greater than two. Could you give some advice on fixing this, maybe by adding a safeguard?

FlorianCassayre commented 4 years ago

Same issue on my side and also wondering how to fix it.

Edit: it seems that the file I was trying to read was using an ANSI encoding scheme (but the parser decided to decode it as ANSEL because the charset was not specified in the header).