[GRASS-dev] [GRASS GIS] #1312: DebCheck QA: Buffer access out-of-bounds

#1312: DebCheck QA: Buffer access out-of-bounds
-------------------------------------------------------+--------------------
Reporter: hamish | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.2
Component: Compiling | Version: 6.4.0
Keywords: d.profile, lib/dspf, r.quant, r.terraflow | Platform: Linux
      Cpu: Unspecified |
-------------------------------------------------------+--------------------
Hi,

Debian's run of the Cpp check tool automatically found a number of C-code
errors (or potential errors) which need to be reviewed by hand. See grass-
dev ML thread of 13 Jan 2011.

about:
''Cppcheck is a command-line tool that tries to detect bugs that your
C/C++ compiler doesn't see. It is versatile, and can check non-standard
code including various compiler extensions, inline assembly code, etc. Its
internal preprocessor can handle includes, macros, and several
preprocessor commands. While Cppcheck is highly configurable, you can
start using it just by giving it a path to the source code.''

  http://www.linuxjournal.com/content/daca-could-mean-less-bugs-debian
the list of probably-bugs in the 6.4.0 C/C++ code:
   http://qa.debian.org/daca/cppcheck/squeeze/grass_6.4.0~rc6+42329-3.html
CLI analysis program (not Debian specific):
   http://cppcheck.wiki.sourceforge.net

I have split those 154 hits into 16 classes, and will report each class in
an individual bug report.

Run against releasebranch6_4 r42329 (including all patches up to, but not
beyond, 6.4.0-final)

----

This bug report is for: '''Buffer access out-of-bounds'''

  * ./display/d.profile/Range.c:27 [error] - Buffer access out-of-bounds:
inbuf
  * ./lib/dspf/cube_io.c:257 [error] - Buffer access out-of-bounds: in_buf
  * ./raster/r.quant/read_rules.c:85 [error] - Buffer access out-of-bounds:
buf
  * ./raster/r.terraflow/nodata.h:65 [error] - Buffer access out-of-bounds
  * ./raster/r.terraflow/plateau.h:50 [error] - Buffer access out-of-bounds

Modules: d.profile, lib/dspf, r.quant, r.terraflow

thanks,
Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1312&gt;
GRASS GIS <http://grass.osgeo.org>

#1312: DebCheck QA: Buffer access out-of-bounds
-------------------------------------------------------+--------------------
Reporter: hamish | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.2
Component: Compiling | Version: 6.4.0
Keywords: d.profile, lib/dspf, r.quant, r.terraflow | Platform: Linux
      Cpu: Unspecified |
-------------------------------------------------------+--------------------

Comment(by hamish):

d.profile fixed in devbr6 with r50180 (n/a to trunk)

r.quant fixed in devbr6 with r50181 (n/a to trunk)

r.terraflow fixed in trunk and devbr6 with r50182,3

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1312#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1312: DebCheck QA: Buffer access out-of-bounds
-------------------------------------------------------+--------------------
Reporter: hamish | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Compiling | Version: 6.4.0
Keywords: d.profile, lib/dspf, r.quant, r.terraflow | Platform: Linux
      Cpu: Unspecified |
-------------------------------------------------------+--------------------
Changes (by neteler):

  * milestone: 6.4.2 => 6.4.3

Comment:

Hamish, please backport if appropriate.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1312#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1312: DebCheck QA: Buffer access out-of-bounds
------------------------+---------------------------------------------------
  Reporter: hamish | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 6.4.3
Component: Compiling | Version: 6.4.0
Resolution: fixed | Keywords: d.profile, lib/dspf, r.quant, r.terraflow
  Platform: Linux | Cpu: Unspecified
------------------------+---------------------------------------------------
Changes (by hamish):

  * status: new => closed
  * resolution: => fixed

Comment:

- d.profile backported to relbr64 by mmetz in r52883.
  - r.quant backported by mmetz in r52896.
  - r.terraflow backported by mmetz in r52904.

lib/dspf/cube_io.c fixed by marisn in r45756.
ported to devbr6 by markusN in r45756 and to trunk in r45773.

done!

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1312#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>