Wireshark-dev: Re: [Wireshark-dev] possible memory error in the SnifferDecompress function?
      
      
From: Lewis Burns <lewisurn@xxxxxxxxx>
Date: Tue, 09 Sep 2014 17:25:26 -0700
| 
  
  
    Hi Guy, Thanks for the tip. Another run with valgrind after using -g with gcc shows the line number. They point to the places that you suspected. I'll file a bug for both invalid write and memory overlap. ==17888== Memcheck, a memory error detector ==17888== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al. ==17888== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info ==17888== Command: ./a.out ==17888== ==17888== Source and destination overlap in memcpy(0x51cc8a7, 0x51cc82b, 146) ==17888== at 0x4C2A690: memcpy (mc_replace_strmem.c:838) ==17888== by 0x40098D: SnifferDecompress (ngsniffer_noklee.c:187) ==17888== by 0x400B38: main (ngsniffer_noklee.c:250) ==17888== ==17888== Source and destination overlap in memcpy(0x51d752d, 0x51d7522, 13) ==17888== at 0x4C2A690: memcpy (mc_replace_strmem.c:838) ==17888== by 0x400A34: SnifferDecompress (ngsniffer_noklee.c:216) ==17888== by 0x400B38: main (ngsniffer_noklee.c:250) ==17888== Cheers, Lewis On 09/09/2014 05:09 PM, Guy Harris
      wrote: 
    On Sep 9, 2014, at 3:11 PM, Lewis Burns <lewisurn@xxxxxxxxx> wrote:We've recently done some unit testing on open source projects. One of issues we've found is related to the SnifferDecompress function in the wiretap/ngsniffer.c file. We're unable to determine that the memory issues shown by valgrind can actually appear in the program due to our unfamiliarity with the code base. I'm sending in a small testcase to the list and hoping that some developers can validate or invalidate that this is a bug in the code.There's one place where the code isn't doing bounds checking, which probably accounts for==5795== Invalid write of size 1 ==5795== at 0x400798: SnifferDecompress (in /home/chaoqiang/workspace/se/klee/exp/a.out) ==5795== by 0x400B6F: main (in /home/chaoqiang/workspace/se/klee/exp/a.out) ==5795== Address 0x521d080 is 0 bytes after a block of size 65,536 alloc'd ==5795== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==5795== by 0x400AE8: main (in /home/chaoqiang/workspace/se/klee/exp/a.out)  | 
- References:
 
- Prev by Date: Re: [Wireshark-dev] possible memory error in the SnifferDecompress function?
 - Next by Date: Re: [Wireshark-dev] possible memory error in the SnifferDecompress function?
 - Previous by thread: Re: [Wireshark-dev] possible memory error in the SnifferDecompress function?
 - Next by thread: [Wireshark-dev] Valgrind profiling results gone bad
 - Index(es):