Package: valgrind
Version: 1:3.5.0-3

A simple use of strlen() leaves valgrind unhappy:

$ cat valg-test.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
        char* s = malloc(5);

        memcpy(s, "aagh", 5);
        printf("%d\n", (int) strlen(s));
        return 0;
}
$ gcc -Wall -W -o valg-test valg-test.c 
$ valgrind ./valg-test
==22406== Memcheck, a memory error detector
==22406== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==22406== Using Valgrind-3.5.0-Debian and LibVEX; rerun with -h for copyright 
info
==22406== Command: ./valg-test
==22406== 
==22406== Conditional jump or move depends on uninitialised value(s)
==22406==    at 0x400C561: _dl_relocate_object (do-rel.h:104)
[... a few Memcheck:Cond from dl.so ...]
==22406== 
==22406== Invalid read of size 4
==22406==    at 0x40A938B: __GI_strlen (strlen.S:115)
==22406==    by 0x404BC84: (below main) (libc-start.c:228)
==22406==  Address 0x418002c is 4 bytes inside a block of size 5 alloc'd
==22406==    at 0x4024C4C: malloc (vg_replace_malloc.c:195)
==22406==    by 0x8048478: main (in /home/jrn/valg-test)
==22406== 
4
==22406== 
[... summary correctly noting the 5 bytes leaked ...]
$

IIRC valgrind should be redirecting strlen() calls to its own, simpler
implementation.  Maybe that is failing for some reason...

$ COLUMNS=72 dpkg -l libc6 libc6-dbg | tail -2
ii  libc6          2.11-0exp4     Embedded GNU C Library: Shared libraries
ii  libc6-dbg      2.11-0exp4     Embedded GNU C Library: detached debugging s
$ uname -r
2.6.33-2-686



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to