This fix can be divided in two parts:
1. Potential OOM due to infinite reading of truncated png images.
Although submitter claimed this as a new regression, the same
problem is present in original method readNullTerminatedString()
(PNGImageReader.java, lines 221 - 229).
To resolve this problem check for EOF and max allowable length
were added to the readNullTerminatedString().
The duplicate of this fiction which handles default charset was
removed: now we just specify the ISO-8859-1 charset for non-utf
There was yet another attribute without specified maximum length:
translated keyword. Now we assume that translated keyword is no
longer that rest of data in the chunk.
2. As a part of original fix for 6541476, some generic usage was
introduced, and this fix converts all collections used in the
png plugin to generics.