Date: 12/06/00
- Next message: Andi Gutmans: "Re: [PHP-DEV] Problem compiling PHP4.0.2 with Openlink ODBC"
- Previous message: Andi Gutmans: "Re: [PHP-DEV] zend_hash_add_or_update flaw"
- In reply to: Andi Gutmans: "Re: [PHP-DEV] zend_hash_add_or_update flaw"
- Next in thread: Andi Gutmans: "Re: [PHP-DEV] zend_hash_add_or_update flaw"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, 6 Dec 2000, Andi Gutmans wrote:
> I don't quite understand what flaw you are talking about.
> pDataPtr is a void *. If the size of the data we are receiving is the same
> size of pDataPtr (sizeof(void *)) we copy it's value to pDataPtr. I don't
> see why doing it via a cast doesn't work. It should work on all platforms.
> pDataPtr = *(void **)pData (where pData is the size of void *).
> What your patch does isn't fixing a flaw (unless I'm missing something) but
> adding functionality by using pDataPtr even if pData is smaller than void *.
> If I'd know that on all systems memcpy() is as fast as doing it with a cast
> I wouldn't mind the patch but I am pretty sure it isn't.
It looks like an alignment problem.
While memcpy handles unaligned accesses to memory properly,
the cast will generate code which assumes that pData is
properly aligned.
Testcase attached.
$ gcc x.c
$ ./a.out
ffbefc60
ffbefc61
Bus Error (core dumped)
$ uname -m
sun4u
- Sascha
- TEXT/plain attachment: x.c
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Andi Gutmans: "Re: [PHP-DEV] Problem compiling PHP4.0.2 with Openlink ODBC"
- Previous message: Andi Gutmans: "Re: [PHP-DEV] zend_hash_add_or_update flaw"
- In reply to: Andi Gutmans: "Re: [PHP-DEV] zend_hash_add_or_update flaw"
- Next in thread: Andi Gutmans: "Re: [PHP-DEV] zend_hash_add_or_update flaw"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

