The following code returns 1 instead of 0 for me. Components.classes["@mozilla.org/xpcom/version-comparator;1"] .getService(Components.interfaces.nsIVersionComparator) .compare("0+", "1pre"); This happens because ParseVP() doesn't initialize numC and extraD if strB=='+'. --- Also, either check the other two parts or document that you ignore them in case if strB starts with '+' (in the nsIVersionComparator.idl). Currently the documentation implies that the other two parts are evaluated even if strB is '+'.
For some reason, on the second iteration of the loop in NS_CompareVersions numC and extraD get nulled, and 1.0+ correctly compares as equal to 1.1pre, but I think this may break on certain compilers. Asking for blocking1.8 for that reason. Don't have a tree, so can't make a patch, sorry.
benjamin, do you think this is a real problem that we should stop the 1.5 release for?
Yeah, there seem to be cases where uninitialized memory can peek through.
Created attachment 199828 [details] [diff] [review] Always initialize versionparts, rev. 1 This initializes the versionparts up front, which is probably how I should have done it in the first place.
Fixed on trunk.
Fixed on 1.8 branch.