Skip to content

Commit

Permalink
OIR: fix off-by-one in XML block reading
Browse files Browse the repository at this point in the history
Trimming the XML string before checking if it's valid meant that
cases where the first byte was a null byte were not being handled
correctly.

Fixes #3779.
  • Loading branch information
melissalinkert committed Aug 9, 2023
1 parent 19d7fb9 commit 6814042
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/formats-gpl/src/loci/formats/in/OIRReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -661,12 +661,12 @@ private void readPixelsFile(String file, RandomAccessInputStream s) throws Forma
break;
}
long fp = s.getFilePointer();
String xml = s.readString(length).trim();
String xml = s.readString(length);
if (!xml.startsWith("<?xml")) {
s.seek(fp - 2);
continue;
}
LOGGER.trace("xml = {}", xml);
xml = xml.trim();
if (((channels.size() == 0 || getSizeX() == 0 || getSizeY() == 0) &&
isCurrentFile(file)) || xml.indexOf("lut:LUT") > 0)
{
Expand Down

0 comments on commit 6814042

Please sign in to comment.