php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #71734 mbfl_string only support unsigned int for string length
Submitted: 2016-03-07 22:04 UTC Modified: 2017-07-22 16:02 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:-1 (-100.0%)
From: yohgaki@php.net Assigned: nikic (profile)
Status: Closed Package: mbstring related
PHP Version: Next Minor Version OS: irrelevant
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: yohgaki@php.net
New email:
PHP Version: OS:

 

 [2016-03-07 22:04 UTC] yohgaki@php.net
Description:
------------
mbstring's string is defined as follows

mbfl_string.h

/*
 * string object
 */
typedef struct _mbfl_string {
	enum mbfl_no_language no_language;
	enum mbfl_no_encoding no_encoding;
	unsigned char *val;
	unsigned int len;
} mbfl_string;

"unsigned int len" should be extended to "size_t len" to support 2GB> strings.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-03-08 09:31 UTC] ab@php.net
Thanks for the checks, Yasuo. This was brought up by Nikita here https://github.com/php/php-src/pull/810 as the PR was partially incompatible, so this issue was overseen.

For how to go with fixing this - IMHO I'd see an issue in just patching the bundled libmbfl. Instead a proper PR should go into https://github.com/moriyoshi/libmbfl . There will be for sure some incompatible places in libmbfl itself once size_t is used. But once it's in and we bundle a new version, we could just revert the patch you've linked. Though, unfortunately it seems that the libmbfl repo doesn't have much activity lately. 

Thanks.
 [2016-03-08 11:36 UTC] yohgaki@php.net
s/support 2GB> strings/support 4GB> strings/
It's "unsigned int".

@anatol
I'll ping libmbfl developers if they can work on it. If not, I may.
 [2017-07-22 16:02 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2017-07-22 16:02 UTC] nikic@php.net
I've switched mbfl_string to use size_t in master.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 17:01:30 2025 UTC