|
From: <sv...@va...> - 2014-11-23 17:55:20
|
Author: sewardj
Date: Sun Nov 23 17:55:13 2014
New Revision: 14766
Log:
Merge, from trunk, r14689
14689 PRE(sys_openat): when checking whether ARG1 == VKI_AT_FDCWD [..]
Modified:
branches/VALGRIND_3_10_BRANCH/ (props changed)
branches/VALGRIND_3_10_BRANCH/coregrind/m_syswrap/syswrap-linux.c (contents, props changed)
Modified: branches/VALGRIND_3_10_BRANCH/coregrind/m_syswrap/syswrap-linux.c
==============================================================================
--- branches/VALGRIND_3_10_BRANCH/coregrind/m_syswrap/syswrap-linux.c (original)
+++ branches/VALGRIND_3_10_BRANCH/coregrind/m_syswrap/syswrap-linux.c Sun Nov 23 17:55:13 2014
@@ -4372,10 +4372,11 @@
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 );
|