NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/51001: src/lib/libc/gdtoa/strtodg.c:560: possible off by one error ?



The following reply was made to PR lib/51001; it has been noted by GNATS.

From: David Holland <dholland-bugs%netbsd.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: lib/51001: src/lib/libc/gdtoa/strtodg.c:560: possible off by one
 error ?
Date: Tue, 31 May 2016 03:40:33 +0000

 On Thu, Mar 24, 2016 at 12:15:00PM +0000, dcb314%hotmail.com@localhost wrote:
  > src/lib/libc/gdtoa/strtodg.c:560] -> [src/lib/libc/gdtoa/strtodg.c:556]: (warning) Either the condition 'e<=24' is redundant or the array 'fivesbits[23]' is accessed at index 24, which is out of bounds.
  > 
  > 
  > Source code is
  > 
  >              if (e <= Ten_pmax) {
  > #ifdef VAX
  >                 goto vax_ovfl_check;
  > #else
  >                 i = fivesbits[e] + mantbits(&rv) <= P;
  > 
  > Maybe the if condition should be
  > 
  >        if (e < Ten_pmax) {
 
 False positive. You've used an inconsistent set of preprocessor
 conditionals. Ten_pmax is 24 only when VAX, when the array indexing in
 question isn't compiled. Otherwise it's 22.
 
 See the definitions of Ten_pmax in gdtoaimp.h.
 
 (What does your scanner do for preprocessing?)
 
 -- 
 David A. Holland
 dholland%netbsd.org@localhost
 


Home | Main Index | Thread Index | Old Index