[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-bugs-dist
Subject: [valgrind] [Bug 326955] New: 64 bit false positive move depends on uninitialised value wcscpy
From: David Dyck <david.dyck () fluke ! com>
Date: 2013-10-31 17:28:52
Message-ID: bug-326955-17878 () http ! bugs ! kde ! org/
[Download RAW message or body]
https://bugs.kde.org/show_bug.cgi?id=326955
Bug ID: 326955
Summary: 64 bit false positive move depends on uninitialised
value wcscpy
Classification: Unclassified
Product: valgrind
Version: 3.7.0
Platform: openSUSE RPMs
OS: Linux
Status: UNCONFIRMED
Severity: major
Priority: NOR
Component: memcheck
Assignee: jseward@acm.org
Reporter: david.dyck@fluke.com
Created attachment 83253
--> https://bugs.kde.org/attachment.cgi?id=83253&action=edit
sample C program that demonstrates false positives
I've attached the sample program valgrind_bug_wcscpy.c
that shows false positives that get in the way of finding
real errors in our code.
The bug does not show up if compiled as a 32 bit program on linux,
or if I use memset() to pre-initialize the buffer.
The bug does not show up if the same program uses the <string.h> functions
strcpy and strlen which is my main argument as to why this is a false
positive.
---------------------
/*
The following program causes valgrind to report an error ( false positive )
Compile:
gcc -m64 -Wall -O0 -g valgrind_bug_wcscpy.c
Execute:
valgrind --track-origins=yes ./a.out
Unexpected and undesirable results (false positive):
==15062== Conditional jump or move depends on uninitialised value(s)
==15062== at 0x4F75F05: __wcscpy_ssse3 (in /lib64/libc-2.15.so)
==15062== by 0x4005B7: main (valgrind_bug.c:31)
==15062== Uninitialised value was created by a stack allocation
==15062== at 0x40058C: main (valgrind_bug.c:23)
*/
// #include <stdio.h>
#include <wchar.h>
#include <string.h>
int main()
{
wchar_t stackbuf1[10]; // if we init on allocation
( = { 0 }) no error
// memset(stackbuf1, 0, sizeof(stackbuf1)); // if we pre-initialize the
buffer, no error
wcscpy(stackbuf1,L"hello"); // initialize (part of) stackbuf1
wchar_t stackbuf2[10];
wcscpy(stackbuf2, stackbuf1); // valgrind reports stackbuf1
unitialized
return wcslen(stackbuf2);
}
--
You are receiving this mail because:
You are watching all bug changes.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic