Skip to content

Commit

Permalink
Merge pull request #4071 from melissalinkert/gh-3582
Browse files Browse the repository at this point in the history
IVision: improve version and data type checks in isThisType
  • Loading branch information
dgault authored Sep 26, 2023
2 parents 3f1fec9 + e6485d3 commit e90bea5
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ public boolean isThisType(RandomAccessInputStream stream) throws IOException {
String version = stream.readString(3);
try {
Double.parseDouble(version);
return version.indexOf('.') != -1 && version.indexOf('-') == -1;
boolean validVersion = version.indexOf('.') != -1 && version.indexOf('-') == -1;
boolean validPatch = Character.isAlphabetic(stream.read());
stream.skipBytes(1);
int dataType = stream.read();
boolean validType = dataType >= 0 && dataType <= 8;
return validVersion && validPatch && validType;
}
catch (NumberFormatException e) { }
return false;
Expand Down

0 comments on commit e90bea5

Please sign in to comment.