1. Wez Furlong
  2. atomicparsley


Oleg Oshmyan  committed 877ea5c

Fix an out-of-bounds array element access

On my machine, it resulted in file_size being reset to zero, thus the whole AtomicParsley becoming totally unusable.

  • Participants
  • Parent commits 4caecca
  • Branches default

Comments (0)

Files changed (1)

File src/parsley.cpp

View file
 	thisAtom->ancillary_data = 0;
 	//set the next atom number of the PREVIOUS atom (we didn't know there would be one until now); this is our default normal mode
-	parsedAtoms[atom_number-1].NextAtomNumber = atom_number;
+	if (atom_number > 0) {
+		parsedAtoms[atom_number-1].NextAtomNumber = atom_number;
+	}
 	thisAtom->NextAtomNumber=0; //this could be the end... (we just can't quite say until we find another atom)
 	if (strncmp(Astring, "mdat", 4) == 0) {