Fossil User Forum

Possible use of uninitalized random variable in uintNocaseCollFunc
Login

Possible use of uninitalized random variable in uintNocaseCollFunc

Possible use of uninitalized random variable in uintNocaseCollFunc

(1) By anonymous on 2022-03-12 18:41:38 [source]

If the first character of zA is a digit, and the first character of zB is not, x is returned without being initialized. In the sqlite source code there is a line setting x between the while and the if.

  int i=0, j=0, x;
  (void)notUsed;
  while( i<nKey1 && j<nKey2 ){
    if( fossil_isdigit(zA[i]) ){
      int k;
      if( !fossil_isdigit(zB[j]) ) return x;

(2.1) By Larry Brasfield (larrybr) on 2022-03-13 01:41:36 edited from 2.0 in reply to 1 [link] [source]

I think you meant "there is [not] a line setting x between ...".

For that reason, it looks like a flawed comparison, as you suggest. It is used on pathnames, and x is set before the next loop iteration if there is one. Since few pathnames begin with a digit, this flaw has been latent.

(Edited to add:)
This was fixed about 30 minutes ago. Thanks for the report.