Skip to main content

The deployJava.js script provided by Sun has a bug

No replies
chiragincontrol
Offline
Joined: 2009-10-06

Java Plugin Detection : Iced Tea VM reports version as 1.6.0 incorrectly passes version check 1.6.0_12+

The deployJava.js script provided by Sun has a bug, in that they only check that the minimum number of digits supplied match, so in this case both have 1.6.0, giving an incorrect positive match.

We need to add the following code commented as "verify remaining digits are zero" to only provide a positive match if the remaming digits in the version number are zero. This would then let 1.6.0 still match against 1.6.0_0 but not 1.6.0_12 (as desired).

if (familyMatch) {
...
} else {
for (var i = 0; i < l; ++i) {
if (result[i] < patternArray[i]) {
return false;
} else if (result[i] > patternArray[i]) {
return true;
}
}

// verify remaining digits are zero
for (var i = l; i < patternArray.length; ++i) {
if (patternArray[i] != "0") {
return false;
}
}

return true;
}