https://bugs.kde.org/show_bug.cgi?id=380397

            Bug ID: 380397
           Summary: s390x: False-positive "invalid read" for strtok()
           Product: valgrind
           Version: 3.13 SVN
          Platform: Other
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: memcheck
          Assignee: jsew...@acm.org
          Reporter: ar...@linux.vnet.ibm.com
  Target Milestone: ---

With glibc 2.24, valgrind emits three "invalid read of size 1" for the program
below.  This is because the strtok implementation on s390x invokes
__strcspn_c(), which operates 4-byte-wise on a word-aligned string pointer. 
The "invalid reads" refer to the three bytes between the 5-byte buffer and the
next word boundary.
On some other platforms the strtok implementation calls strcspn via a PLT slot,
in which case Valgrind's replacement for strcspn gets invoked instead.

-- >8 --
#include <string.h>

int main(int argc, char *argv[])
{
        strtok(strdup("xxxx"), "ab");

        return 0;
}

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to