]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Merge, from trunk, r14689
authorJulian Seward <jseward@acm.org>
Sun, 23 Nov 2014 17:55:13 +0000 (17:55 +0000)
committerJulian Seward <jseward@acm.org>
Sun, 23 Nov 2014 17:55:13 +0000 (17:55 +0000)
14689  PRE(sys_openat): when checking whether ARG1 == VKI_AT_FDCWD [..]

git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_3_10_BRANCH@14766

coregrind/m_syswrap/syswrap-linux.c

index e36036f21af5498e26d3a9b12c8cd8a23b3dfb0c..37932814ad2aee96f8d5b267b0d458cc5b7bf5d8 100644 (file)
@@ -4372,10 +4372,11 @@ PRE(sys_openat)
    PRE_MEM_RASCIIZ( "openat(filename)", ARG2 );
 
    /* For absolute filenames, dfd is ignored.  If dfd is AT_FDCWD,
-      filename is relative to cwd.  */
+      filename is relative to cwd.  When comparing dfd against AT_FDCWD,
+      be sure only to compare the bottom 32 bits. */
    if (ML_(safe_to_deref)( (void*)ARG2, 1 )
        && *(Char *)ARG2 != '/'
-       && ARG1 != VKI_AT_FDCWD
+       && ((Int)ARG1) != ((Int)VKI_AT_FDCWD)
        && !ML_(fd_allowed)(ARG1, "openat", tid, False))
       SET_STATUS_Failure( VKI_EBADF );