Weekly cppcheck run against Aug 27 Git Tree
jjmckenzie51 at earthlink.net
Thu Aug 27 22:58:04 CDT 2009
Mike Kaplinskiy wrote:
> On Thu, Aug 27, 2009 at 3:52 PM, chris ahrendt<celticht32 at yahoo.com> wrote:
>> This is the result of running cppcheck 1.35 with the --all parm against
>> the august 27th Git tree:
>> [../wine-git/dlls/dbghelp/msc.c:88]: (possible error) Array index out of
>> [../wine-git/dlls/dbghelp/msc.c:89]: (possible error) Array index out of
> False positive, apparently the numbers are hardcoded as:
> 72 char msg;
> 88 msg[10 + 3 * 16] = ' '; // = 58<127
Why not just say 58 instead of the complex math?
> 89 msg[10 + 3 * 16 + 1 + 16] = '\0'; // = 75<127
Same here. Why not 75 instead of the math formula?
This is relying on a certain path for math which may or may not be true
(RPN anyone?) It was best practice to use constants vice complex math
to determine array locations or to set and test a variable before the call.
I could see this if a variable was used in the math formula that was
checked for out of bounds, but this is not the case.
More information about the wine-devel