|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18039 wrong length of output string
Submitted: 2002-06-28 03:09 UTC Modified: 2002-06-28 03:12 UTC
From: novicky at aarongroup dot cz Assigned:
Status: Closed Package: ICONV related
PHP Version: 4.2.1 OS: All
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: novicky at aarongroup dot cz
New email:
PHP Version: OS:


 [2002-06-28 03:09 UTC] novicky at aarongroup dot cz
There is a bug in ext/iconv/iconv.c file on line 234.

When you do not use libiconv and the output (translated) string is longer than the input string, you obtain a wrong length of the output string.

The problem is that there is an output buffer estimate (input buffer length + 32 bytes):

out_left = in_len + 32; /* Avoid realloc() most cases */ 
bsz = out_left;

but during output buffer realloc there is in_len used instead of bsz:

out_left = in_len;
out_size += bsz - out_left;

The correction should by made on line 234:

out_left = in_len;

should by:

out_left = bsz;


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-28 03:12 UTC]
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at In case this was a documentation 
problem, the fix will show up soon at
In case this was a website problem, the change will show
up on the site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Jun 16 14:01:23 2021 UTC