php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30558 mbstring mbregex failure to compile pointer cast problems
Submitted: 2004-10-26 09:41 UTC Modified: 2006-01-01 01:00 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 2 (50.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: jbarwick at sentienthealth dot com Assigned: moriyoshi (profile)
Status: No Feedback Package: mbstring related
PHP Version: 4.3.8 OS: SuSE 9.1 (amd64)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jbarwick at sentienthealth dot com
New email:
PHP Version: OS:

 

 [2004-10-26 09:41 UTC] jbarwick at sentienthealth dot com
Description:
------------
The entire MBREGEX.C object appears to be written with "pointer address math" using "int" variables.

Whereas we all know that with the invent of i586/i686 systems the int veriable is nicely 32 bit, in a 64 bit environment, the pointers and the uint/int objects become completely incompatible.

(Am I crazy here?)...or completely stupid?  

Anyway...lot's of "pointer errors" in mbstring/mbregex.  It appears that this module is totally unusable in a 64-bit environment.

To FIX, I did the following

mbstring/mbregex/mbregex.h

#define MINT long
#define MLONG long

The changed all "int"'s to "MINT"
and changed all "long"'s to "MLONG"

with a nice search and replace.

Compiled with no compiler warnings (retesting make clean/make as we speak).

It actually appears that the entire mbstring object must be completely re-written.  SOOOO much pointer math using int's and so many "cast from pointer to integer of different size" errors.

any chance of getting 4.3.9 or 4.3.10 compilable for 64-bit?

I have a lot of work left to fix all the mbstring files that wont compile correctly...errrrg!!!

PLEASE someone tell me I can ignore these because the pointer math works even when the compiler complains!!

Reproduce code:
---------------
compile mbstring/mbregex.c

Expected result:
----------------
no compiler warnings about bad pointers

Actual result:
--------------
compiler warnings about bad pointers

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-04 13:09 UTC] tony2001@php.net
Please, provide all warnings and/or errors you get.
 [2004-11-04 14:27 UTC] jorton at redhat dot com
gcc -Wall output for ext/mbstring from amd64 build of HEAD:

ext/mbstring/oniguruma/regexec.c: In function `match_at':
ext/mbstring/oniguruma/regexec.c:1106: warning: cast to pointer from integer of different size
ext/mbstring/oniguruma/regexec.c:1110: warning: cast to pointer from integer of different size
ext/mbstring/oniguruma/regexec.c:1126: warning: cast to pointer from integer of different size
ext/mbstring/oniguruma/regexec.c:1130: warning: cast to pointer from integer of different size
ext/mbstring/oniguruma/regexec.c:1763: warning: cast from pointer to integer of different size
ext/mbstring/oniguruma/regexec.c:1777: warning: cast from pointer to integer of different size
ext/mbstring/oniguruma/regexec.c:1794: warning: cast from pointer to integer of different size
ext/mbstring/oniguruma/regexec.c:1800: warning: cast from pointer to integer of different size
ext/mbstring/oniguruma/regexec.c:1839: warning: cast to pointer from integer of different size
ext/mbstring/oniguruma/regexec.c:1843: warning: cast to pointer from integer of different size
ext/mbstring/oniguruma/regexec.c:1871: warning: cast to pointer from integer of different size
ext/mbstring/oniguruma/regexec.c:1875: warning: cast to pointer from integer of different size
ext/mbstring/oniguruma/regexec.c:1903: warning: cast to pointer from integer of different size
ext/mbstring/oniguruma/regexec.c:1907: warning: cast to pointer from integer of different size
ext/mbstring/oniguruma/regexec.c:1942: warning: cast to pointer from integer of different size
ext/mbstring/oniguruma/regexec.c:1946: warning: cast to pointer from integer of different size
ext/mbstring/oniguruma/regexec.c:2027: warning: cast to pointer from integer of different size
ext/mbstring/oniguruma/regexec.c:2050: warning: cast to pointer from integer of different size
ext/mbstring/oniguruma/regexec.c:1138: warning: `pstart' might be used uninitialized in this function
ext/mbstring/oniguruma/regparse.c: In function `not_code_range_buf':
ext/mbstring/oniguruma/regparse.c:1628: warning: `to' might be used uninitialized in this function
ext/mbstring/libmbfl/filters/mbfilter_htmlent.c: In function `mbfl_filt_conv_html_dec_ctor':
ext/mbstring/libmbfl/filters/mbfilter_htmlent.c:161: warning: cast from pointer to integer of different size
ext/mbstring/libmbfl/filters/mbfilter_htmlent.c: In function `mbfl_filt_conv_html_dec_dtor':
ext/mbstring/libmbfl/filters/mbfilter_htmlent.c:169: warning: cast to pointer from integer of different size
ext/mbstring/libmbfl/filters/mbfilter_htmlent.c: In function `mbfl_filt_conv_html_dec':
ext/mbstring/libmbfl/filters/mbfilter_htmlent.c:178: warning: cast to pointer from integer of different size
ext/mbstring/libmbfl/filters/mbfilter_htmlent.c: In function `mbfl_filt_conv_html_dec_flush':
ext/mbstring/libmbfl/filters/mbfilter_htmlent.c:249: warning: cast to pointer from integer of different size
 [2004-11-04 14:37 UTC] jorton@php.net
I'm not sure if jbarwick's suggested fix:

The changed all "int"'s to "MINT"
and changed all "long"'s to "MLONG"

is really advisable; Moriyoshi, have you looked at this?  ISTR it being mentioned before on php-dev.

 [2004-11-20 11:14 UTC] moriyoshi@php.net
Just a note, I'm currently working on this.
Stay tuned.
 [2005-03-04 04:03 UTC] jbarwick at sentienthealth dot com
as far as I know the developer is still porting mbstring to 64bit environment.  

Although...my hack is working just fine...So far..<grin>

Let's try to keep this open a bit longer to see if we can get an "official" version.
 [2005-12-24 02:17 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip


 [2006-01-01 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jan 15 14:01:30 2025 UTC