[RTEMS Project] #4485: GcovData.cc: Out-of-bounds acces errors spotted by Coverity

RTEMS trac trac at rtems.org
Wed Aug 4 18:22:36 UTC 2021


#4485: GcovData.cc: Out-of-bounds acces errors spotted by Coverity
------------------------+--------------------
  Reporter:  Ryan Long  |      Owner:  (none)
      Type:  defect     |     Status:  new
  Priority:  normal     |  Milestone:  6.1
 Component:  tool       |    Version:  6
  Severity:  normal     |   Keywords:
Blocked By:             |   Blocking:
------------------------+--------------------
 CID 1506208: Out-of-bounds access
 {{{
    CID 1506208 (#1 of 1): Out-of-bounds access (OVERRUN)2. overrun-buffer-
 arg: Overrunning struct type _ZN4Gcov13gcov_preambleE of 12 bytes by
 passing it to a function which accesses it at byte offset 47 using
 argument 48L.
 132    gcdaFile.write( (char *) &preamble , 4 * sizeof( preamble ) );
 133    if ( gcdaFile.fail() ) {
 134      std::cerr << "Error while writing gcda preamble to a file "
 135                << gcdaFileName << std::endl;
 136    }
 }}}

 CID 1506209: Out-of-bounds access
 {{{
    CID 1506209 (#1 of 1): Out-of-bounds access (OVERRUN)1. overrun-buffer-
 arg: Overrunning buffer pointed to by (char *)&preamble of 8 bytes by
 passing it to a function which accesses it at byte offset 47 using
 argument 48L.
 400    gcovFile.read( (char *) &preamble, 4 * sizeof( gcov_preamble ) );
 401    if ( gcovFile.gcount() != 4 * sizeof( gcov_preamble ) ) {
 402      std::cerr << "Error while reading file preamble" << std::endl;
 403      return -1;
 404    }
 }}}

--
Ticket URL: <http://devel.rtems.org/ticket/4485>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list