php_stream_cast to fd

From: Date: Tue, 11 Mar 2008 09:42:14 +0000
Subject: php_stream_cast to fd
Groups: php.internals 
Request: Send a blank email to internals+get-36092@lists.php.net to get a copy of this message
When php_stream_cast is passed any of the _AS_FD-like options, what is the ret argument supposed to point to? This does not seem to be decided consistently; from a quick survey: ext/openssl/xp_ssl.c: php_openssl_sockop_cast() presumes that *ret has sizeof(void *) ext/soap/php_http.c: stream_alive() presumes that *ret has sizeof(long) ext/standard/streamfuncs.c: stream_array_from_fd_set() presumes that *ret has sizeof(php_socket_t) main/streams/xp_socket.c: php_sockop_cast() presumes that *ret has sizeof(int) On 64-bit platforms, of course, at least half of these cases will break, since sizeof(int) != sizeof(long). This issue is the cause of http://bugs.php.net/bug.php?id=32979, where a 64-bit value is being written to an pointer to a 32-bit value on the stack, and trashing whatever follows it. joe

« previous php.internals (#36092) next »