]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix 316535 Use of |signed int| instead of (unsigned) |size_t| in messages...
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Wed, 13 Mar 2013 21:44:07 +0000 (21:44 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Wed, 13 Mar 2013 21:44:07 +0000 (21:44 +0000)
* when SEGV trapped, report the main thread size as an unsigned size_t
* Similar for memcheck overlap errors
  For example, for the 2 calls:
     memcpy(&a, &a, 2147483648UL);
     memcpy(&a, &a, -1);  // silently accepted by gcc 4.4.4 -Wall
                          // while the 3rd arg is supposed to be a size_t
  we now obtain (on a 32 bit system)
    Source and destination overlap in memcpy(0xbe97113f, 0xbe97113f, 2147483648)
    Source and destination overlap in memcpy(0xbef6d13f, 0xbef6d13f, 4294967295)
  instead of
    Source and destination overlap in memcpy(0xbe8e012f, 0xbe8e012f, -2147483648)
    Source and destination overlap in memcpy(0xbe8e012f, 0xbe8e012f, -1)

Do not ask me why
   memcpy(&a, &a, -1);
is supposed to be accepted/acceptable/valid code.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13326

NEWS
coregrind/m_signals.c
memcheck/mc_errors.c

diff --git a/NEWS b/NEWS
index bd7cd8347812fb392bc419a8e4617387a5e39a70..4c6194a9ec1c2a7532181424806de14bf2076daf 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -217,6 +217,7 @@ m = merged into 3_8_BRANCH
         FIXED 13294
 
 315545    [390] (find_TTEntry_from_hcode): Assertion '(UChar*)sec->tt[tteNo].tcptr <= (UChar*)hcode' failed
+316535    [390] Use of |signed int| instead of (unsigned) |size_t| in valgrind messages...
 315959    [390] valgrind man page has bogus SGCHECK (and no BBV) OPTIONS section
 316144    [390] valgrind.1 manpage contains unknown ??? strings for some core option references
 316145    [390] callgrind command line options in manpage reference (unknown) callgrind manual
index bb0ca72c0c291448e4b4b7d1a596b4d6b94f5e4b..8c65b11b163ff8ec216dd2e2f301b173f384a977 100644 (file)
@@ -1716,8 +1716,8 @@ static void default_action(const vki_siginfo_t *info, ThreadId tid)
          // FIXME: assumes main ThreadId == 1
          if (VG_(is_valid_tid)(1)) {
             VG_(umsg)(
-               " The main thread stack size used in this run was %d.\n",
-               (Int)VG_(threads)[1].client_stack_szB);
+               " The main thread stack size used in this run was %lu.\n",
+               VG_(threads)[1].client_stack_szB);
          }
       }
    }
index 9d8d598cc13e9d2ff7d1f09712738b76b21503d0..62cc0b73a8c76d4010f40715e0b37d54beec7a09 100644 (file)
@@ -235,9 +235,9 @@ struct _MC_Error {
 
       // Call to strcpy, memcpy, etc, with overlapping blocks.
       struct {
-         Addr src;   // Source block
-         Addr dst;   // Destination block
-         Int  szB;   // Size in bytes;  0 if unused.
+         Addr  src;   // Source block
+         Addr  dst;   // Destination block
+         SizeT szB;   // Size in bytes;  0 if unused.
       } Overlap;
 
       // A memory leak.
@@ -845,7 +845,7 @@ void MC_(pp_Error) ( Error* err )
                      extra->Err.Overlap.dst, extra->Err.Overlap.src );
             } else {
                emit( "  <what>Source and destination overlap "
-                     "in %s(%#lx, %#lx, %d)</what>\n",
+                     "in %s(%#lx, %#lx, %lu)</what>\n",
                      VG_(get_error_string)(err),
                      extra->Err.Overlap.dst, extra->Err.Overlap.src,
                      extra->Err.Overlap.szB );
@@ -857,7 +857,7 @@ void MC_(pp_Error) ( Error* err )
                      VG_(get_error_string)(err),
                      extra->Err.Overlap.dst, extra->Err.Overlap.src );
             } else {
-               emit( "Source and destination overlap in %s(%#lx, %#lx, %d)\n",
+               emit( "Source and destination overlap in %s(%#lx, %#lx, %lu)\n",
                      VG_(get_error_string)(err),
                      extra->Err.Overlap.dst, extra->Err.Overlap.src,
                      extra->Err.Overlap.szB );