#30573 [Opn->Asn]: Compiler Warning Due to Invalid Incorrect Type Cast
| From: | tony2001@php.net | Date: | Thu, 04 Nov 2004 10:16:10 +0000 |
| Subject: | #30573 [Opn->Asn]: Compiler Warning Due to Invalid Incorrect Type Cast | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-68681@lists.php.net to get a copy of this message | ||
ID: 30573
Updated by: tony2001@php.net
Reported By: jbarwick at sentienthealth dot com
-Status: Open
+Status: Assigned
Bug Type: Compile Warning
Operating System: SuSE9.1 (amd64)
PHP Version: 4.3.8
-Assigned To:
+Assigned To: moriyoshi
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