bugGnome Chemistry Utils - Bugs: bug #41261, libs/gcr/line.cc:317: (style)...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #41261: libs/gcr/line.cc:317: (style) Array index 'i' is used before limits check.

Submitted by:  David Binderman <dcb314>
Submitted on:  Fri 17 Jan 2014 09:26:14 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Fri 17 Jan 2014 01:03:50 PM UTC, comment #1:

Good catch, thanks for reporting.

Jean Bréfort <jean_brefort>
Project Administrator
Fri 17 Jan 2014 09:26:14 AM UTC, original submission:

Source code is

while (strcmp (txt, LineTypeName[i]) && (i < 5))
i++;

Maybe

while ((i < 5) && strcmp (txt, LineTypeName[i]))
i++;

might be better code. This problem found by cppcheck, a
static analyser for C / C++ code.

David Binderman <dcb314>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by dcb314 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 17 Jan 2014 01:03:50 PM UTCjean_brefortStatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1