[augeas-devel] [Augeas] #294: Invalid read of size 8
Augeas
trac at fedorahosted.org
Sun Aug 12 13:18:37 UTC 2012
#294: Invalid read of size 8
-------------------------+--------------------
Reporter: fgiraldeau | Owner: lutter
Type: defect | Status: new
Priority: major | Milestone: next
Component: Augeas | Version: devel
Resolution: | Keywords:
Blocked By: | Blocking:
-------------------------+--------------------
Comment (by fgiraldeau):
Just to confirm that this is indeed the case, here is a short program that
raise the valgrind invalid read:
{{{
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv) {
char *dst = (char *) calloc(4, 1);
char *src = (char *) calloc(4, 1);
src[0] = 'a';
src[1] = 'b';
src[2] = 'c';
src[3] = '\0';
dst = stpncpy(dst, src, 3);
printf("%s %s\n", src, dst);
}
}}}
{{{
$ valgrind ./a.out
==21946== Memcheck, a memory error detector
==21946== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==21946== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright
info
==21946== Command: ./a.out
==21946==
==21946== Invalid read of size 8
==21946== at 0x4ECA554: __stpncpy_sse2_unaligned (strcpy-
sse2-unaligned.S:297)
==21946== by 0x400608: main (in /data/francis/workspace/augeas/a.out)
==21946== Address 0x51ef090 is 0 bytes inside a block of size 4 alloc'd
==21946== at 0x4C29DB4: calloc (in /usr/lib/valgrind
/vgpreload_memcheck-amd64-linux.so)
==21946== by 0x4005C4: main (in /data/francis/workspace/augeas/a.out)
==21946==
==21946== Invalid read of size 8
==21946== at 0x4ECA558: __stpncpy_sse2_unaligned (strcpy-
sse2-unaligned.S:298)
==21946== by 0x400608: main (in /data/francis/workspace/augeas/a.out)
==21946== Address 0x51ef0a0 is 12 bytes after a block of size 4 alloc'd
==21946== at 0x4C29DB4: calloc (in /usr/lib/valgrind
/vgpreload_memcheck-amd64-linux.so)
==21946== by 0x4005C4: main (in /data/francis/workspace/augeas/a.out)
==21946==
abc
}}}
--
Ticket URL: <https://fedorahosted.org/augeas/ticket/294#comment:4>
Augeas <http://augeas.net/>
a configuration API
More information about the augeas-devel
mailing list