After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 679620 - [PATCH] used array index before limits check in file doxygen-svn/src/markdown.cpp
[PATCH] used array index before limits check in file doxygen-svn/src/markdown...
Status: RESOLVED NOTABUG
Product: doxygen
Classification: Other
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Dimitri van Heesch
Dimitri van Heesch
Depends on:
Blocks:
 
 
Reported: 2012-07-09 10:59 UTC by Ettl Martin
Modified: 2012-11-18 11:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch (1.05 KB, patch)
2012-07-09 10:59 UTC, Ettl Martin
none Details | Review

Description Ettl Martin 2012-07-09 10:59:22 UTC
Created attachment 218325 [details] [review]
proposed patch 

Please find attached a patch that fixes three issues, where first an array index is used and then its bound (limits) are checked. It is better to first check if the index is within the bounds and then use the index.

Best regards

Ettl Martin
Comment 1 Dimitri van Heesch 2012-07-09 17:59:44 UTC
These are not real issues!

In every case the data[i] is inside a guard that already checks that i<size.

Using 

  data[i]=='-' && i<size-2 && data[i+1]=='#' && data[i+2]==' '

instead of 

  i<size-2 && data[i]=='-' && data[i+1]=='#' && data[i+2]==' '

has a slight performance benefit as data[i] is more likely to evaluate to false.