Re: [PATCH] sparse: Use memmove in sort.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 23, 2014 at 9:38 PM, Rasmus Villemoes <rv@xxxxxxxxxxxxxxxxxx> wrote:
> Using valgrind on the example ctags program I get
>
> ==16863== Source and destination overlap in memcpy(0x7ff000100, 0x7ff000108, 192)
> ==16863==    at 0x4C2A690: memcpy (mc_replace_strmem.c:838)
> ==16863==    by 0x412D86: merge_block_seqs (sort.c:207)
> ==16863==    by 0x41303C: sort_list (sort.c:275)
> ==16863==    by 0x401225: main (ctags.c:224)
>
> Fix it by using memmove instead of memcpy.

This bug has been fixed in the chrisl repository as commit:
6c2d743d2f130a8bf9014410f928bae3647e3108

The first memcpy is fine, one of the buffer is in the stack, the ptr
pointer is allocated using mmap. So they will never overlap.

The second memcpy is a real bug. It has been reported by Hans Verkuil.
It took me a while to fix the real cause. Because the corrupted
ptr list still contain valid ptr pointers. The symptoms has very odd
duplicate entries. It took me a while to find out the real cause.

If you send this patch earlier, it would have save me a lot of time.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux