Skip to content

Commit

Permalink
Fix potential off-by-one in metadata offset
Browse files Browse the repository at this point in the history
Closes #8009.

To test:

ant -Dtestng.directory=$DATA/sis/ test-automated
  • Loading branch information
melissalinkert committed Feb 7, 2012
1 parent 1c86b19 commit eaf651e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions components/bio-formats/src/loci/formats/in/SISReader.java
Expand Up @@ -151,6 +151,11 @@ protected void initStandardMetadata() throws FormatException, IOException {
short check = in.readShort();
while (check != 7 && check != 8) {
check = in.readShort();

if (check == 0x700 || check == 0x800) {
in.skipBytes(1);
break;
}
}
in.skipBytes(4);

Expand All @@ -176,6 +181,10 @@ protected void initStandardMetadata() throws FormatException, IOException {
cameraName = channelName.substring(0, length);
}

// these are no longer valid
getGlobalMetadata().remove("XResolution");
getGlobalMetadata().remove("YResolution");

addGlobalMeta("Nanometers per pixel (X)", physicalSizeX);
addGlobalMeta("Nanometers per pixel (Y)", physicalSizeY);
addGlobalMeta("Magnification", magnification);
Expand Down

0 comments on commit eaf651e

Please sign in to comment.