[rtems commit] tools/build/*.c: Clean up issues reported by CodeSonar

Joel Sherrill joel.sherrill at oarcorp.com
Thu Nov 27 15:36:22 UTC 2014


On 11/27/2014 02:26 AM, Sebastian Huber wrote:
> On 26/11/14 14:55, Joel Sherril wrote:
>> Module:    rtems
>> Branch:    master
>> Commit:    b1643030121f5ea336670cc9474f4a4a0b2a21eb
>> Changeset:http://git.rtems.org/rtems/commit/?id=b1643030121f5ea336670cc9474f4a4a0b2a21eb
>>
>> Author:    Josh Oguin<josh.oguin at oarcorp.com>
>> Date:      Tue Nov 25 15:55:49 2014 -0600
>>
>> tools/build/*.c: Clean up issues reported by CodeSonar
>>
>> This code is built without warnings and ignored by Coverity Scan.
>> CodeSonar found a wide range of issues including buffer overruns,
>> buffer underruns, questionable type conversions, leaks, etc. This
>> set of patches addresses all reported issues.
>>
>> ---
>>
>>    tools/build/binpatch.c    | 144 ++++++++++++++--------------
>>    tools/build/cklength.c    |  28 +++---
>>    tools/build/eolstrip.c    |  14 ++-
>>    tools/build/rtems-bin2c.c | 233 ++++++++++++++++++++++++----------------------
>>    tools/build/unhex.c       | 196 +++++++++++++++++++-------------------
>>    5 files changed, 309 insertions(+), 306 deletions(-)
> This change leads to:

Sorry. Somehow the build sweeps I was doing either didn't build tests
or didn't build with networking enabled.

Fixed now. Turned out to be malloc'ed memory where the original
pointer was modified so it freed a pointer that was in the middle
of the block.
> gmake[6]: Entering directory
> `/scratch/git-build/b-smp-ngmp/sparc-rtems4.11/c/ngmp/testsuites/libtests/mghttpd01'
> ../../../../../../tools/build/rtems-bin2c -C
> /home/sh/rtems-4.11/c/src/../../testsuites/libtests/mghttpd01/init_fs.tar init_fs
> *** Error in `../../../../../../tools/build/rtems-bin2c': free():
> invalid pointer: 0x00000000012344ce ***
> ======= Backtrace: =========
> /lib64/libc.so.6(+0x73d8f)[0x7fa7f74c0d8f]
> /lib64/libc.so.6(+0x795ee)[0x7fa7f74c65ee]
> /lib64/libc.so.6(+0x7a2c7)[0x7fa7f74c72c7]
> ../../../../../../tools/build/rtems-bin2c[0x400ca0]
> ../../../../../../tools/build/rtems-bin2c[0x4008e0]
> /lib64/libc.so.6(__libc_start_main+0xf5)[0x7fa7f746ebe5]
> ../../../../../../tools/build/rtems-bin2c[0x4009c1]
> ======= Memory map: ========
> 00400000-00402000 r-xp 00000000 08:16 15466972
> /scratch/git-build/b-smp-ngmp/tools/build/rtems-bin2c
> 00601000-00602000 r--p 00001000 08:16 15466972
> /scratch/git-build/b-smp-ngmp/tools/build/rtems-bin2c
> 00602000-00603000 rw-p 00002000 08:16 15466972
> /scratch/git-build/b-smp-ngmp/tools/build/rtems-bin2c
> 01234000-01255000 rw-p 00000000 00:00 0
> [heap]
> 7fa7f7236000-7fa7f724c000 r-xp 00000000 08:01 2490378
> /lib64/libgcc_s.so.1
> 7fa7f724c000-7fa7f744b000 ---p 00016000 08:01 2490378
> /lib64/libgcc_s.so.1
> 7fa7f744b000-7fa7f744c000 r--p 00015000 08:01 2490378
> /lib64/libgcc_s.so.1
> 7fa7f744c000-7fa7f744d000 rw-p 00016000 08:01 2490378
> /lib64/libgcc_s.so.1
> 7fa7f744d000-7fa7f75f2000 r-xp 00000000 08:01 2490421
> /lib64/libc-2.18.so
> 7fa7f75f2000-7fa7f77f1000 ---p 001a5000 08:01 2490421
> /lib64/libc-2.18.so
> 7fa7f77f1000-7fa7f77f5000 r--p 001a4000 08:01 2490421
> /lib64/libc-2.18.so
> 7fa7f77f5000-7fa7f77f7000 rw-p 001a8000 08:01 2490421
> /lib64/libc-2.18.so
> 7fa7f77f7000-7fa7f77fb000 rw-p 00000000 00:00 0
> 7fa7f77fb000-7fa7f781b000 r-xp 00000000 08:01 2500696
> /lib64/ld-2.18.so
> 7fa7f79f0000-7fa7f79f3000 rw-p 00000000 00:00 0
> 7fa7f7a18000-7fa7f7a1a000 rw-p 00000000 00:00 0
> 7fa7f7a1a000-7fa7f7a1b000 r--p 0001f000 08:01 2500696
> /lib64/ld-2.18.so
> 7fa7f7a1b000-7fa7f7a1c000 rw-p 00020000 08:01 2500696
> /lib64/ld-2.18.so
> 7fa7f7a1c000-7fa7f7a1d000 rw-p 00000000 00:00 0
> 7fff2f170000-7fff2f192000 rw-p 00000000 00:00 0
> [stack]
> 7fff2f1fe000-7fff2f200000 r-xp 00000000 00:00 0
> [vdso]
> ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0
> [vsyscall]
> gmake[6]: *** [init_fs.c] Aborted
> gmake[6]: *** Deleting file `init_fs.c'
> gmake[6]: Leaving directory
> `/scratch/git-build/b-smp-ngmp/sparc-rtems4.11/c/ngmp/testsuites/libtests/mghttpd01'
> gmake[5]: *** [all-local] Error 1
>




More information about the devel mailing list