#30573 [Asn->Csd]: Compiler Warning Due to Invalid Incorrect Type Cast
| From: | moriyoshi@php.net | Date: | Mon, 21 Feb 2005 10:15:20 +0000 |
| Subject: | #30573 [Asn->Csd]: Compiler Warning Due to Invalid Incorrect Type Cast | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-74332@lists.php.net to get a copy of this message | ||
ID: 30573
Updated by: moriyoshi@php.net
Reported By: jbarwick at sentienthealth dot com
-Status: Assigned
+Status: Closed
Bug Type: Compile Warning
Operating System: SuSE9.1 (amd64)
PHP Version: 4.3.8
Assigned To: moriyoshi
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2004-10-27 04:10:16] jbarwick at sentienthealth dot com
Description:
------------
file in consideration:
ext/mbstring/libmbfl/filters/mbfilter_htmlent.c line 156
The line in question is written as:
filter->cache = (int)mbfl_malloc(html_enc_buffer_size+1);
This line is invalid on 64 bit systems as mbfl_malloc should be
returning a pointer (64 bit) and int is not...
filter->cache is defined as a long ... questions, should it be ulong?
don't wanna change it cuz I don't know if there is any negative math
used here....
Anyway, if we rewrite the line to:
filter->cache = (long)mbfl_malloc(html_enc_buffer_size+1);
we fix the invalid data type size, and this WILL work on both 32 bit
and 64 bit systems.
Throwing away the top 32 bits of a 64 bit pointer is extremely
dangerous...don't you think?
Reproduce code:
---------------
compile the source
Expected result:
----------------
no compiler warnings
Actual result:
--------------
compiler warnings:
cast from pointer ot integer of different size..
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30573&edit=1