Archive: VersionCheckNew null Bug


VersionCheckNew null Bug
  Afro,

Found a bug in versionchecknew... You almost had it but just missed one small piece...

If you look below in the first two StrCpy's, you append the . to the end of $R0 and $R1. Then you look to see if $R0 and $R1 are null, which they never will be. For ex. if $R0 and $R1 are null then @Next $R0$R1 = ".." and the latter test for single $R0 or $R1 is null is testing against "." so will never set the value to "0.".

Present Code:


  StrCpy $R1 $R1.

StrCpy $R0 $R0.

>Next: StrCmp $R0$R1 ".." 0 +3
StrCpy $R0 0
Goto Done

StrCmp $R0"" 0 +2
StrCpy $R0 0.
StrCmp $R1"" 0 +2
StrCpy $R1 0.
>
Easily modified code:

  StrCpy $R1 $R1.

StrCpy $R0 $R0.

>Next: StrCmp $R0$R1 ".." 0 +3
StrCpy $R0 0
Goto Done

StrCmp $R0"." 0 +2
StrCpy $R0 0.
StrCmp $R1"." 0 +2
StrCpy $R1 0.
>
Just a heads up...

Later all...

out of sheer curiosity.. why aren't you using ${VersionCompare} out of WordFunc.nsh (as mentioned in the other thread)? VersionCompare was based on VersionCheckNew2 (VersionCheckNewNew!) and should behave solidly.. it's part of your NSIS install; whereas any iteration of VersionCheck isn't.


no particular reason, was the first version comparison I came across... Are there any benifits to using the VersionCompare opposed to VersionCheckNew5 or versionchecknewnewnewnewnew ;) :P


Animaether already gave a benefit; VersionCompare is based on VersionCheckNew (and therefore improves upon it). Also anything included with NSIS is 99% certain to be solid as it will have been used by the most people and therefore tested thoroughly.

In fact, the VersionCheckNew Wiki page clearly states it has a bug and to use VersionCompare.

Stu