php.net |  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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
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;



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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