|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56785 Decompression fails on large files
Submitted: 2006-01-19 14:15 UTC Modified: 2006-07-05 20:12 UTC
From: valeriu at palos dot ro Assigned:
Status: Closed Package: lzf (PECL)
PHP Version: 5.0.4 OS: Fedora Core 4
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: valeriu at palos dot ro
New email:
PHP Version: OS:


 [2006-01-19 14:15 UTC] valeriu at palos dot ro
I am using LZF-1.3
Php modules: gd, ldap, lzf, mmcache, mysql, mysqli, odbc, pgsql, rar, xdebug
The only change I made to php.ini is that I increased the memory size to 32 M

Reproduce code:
$UCdata='';  // create an uncompressed string
$UCdata.=chr(ord('a')+rand(0,26));  //fill with letters
$Cdata=lzf_compress($UCdata);  // compress the string
$UCsize=strlen($UCdata);  // memorize uncompressed size
$Csize=strlen($Cdata);  // memorize compressed size
$DCdata=lzf_decompress($Cdata);  // decompress the string
$DCsize=strlen($DCdata);  // memorize the decompressed size
// print the memorized sizes
echo 'UC: '.$UCsize.', C: '.$Csize.', DC: '.$DCsize;
// On almost every run of this script I get
// different(truncated) output from lzf_decompress()!

Expected result:
It should be something like... (C varies)

UC: 10000, C: 9736, DC: 10000

Actual result:
It output's something like...

UC: 10000, C: 9736, DC: 1024

The DC should be equal with UC!


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-05 11:27 UTC] msquillace at sogei dot it
The problem can be solved by changing the while() test at the end of lzf_d.c from:

while (op < out_end && ip < in_end);


while (op <= out_end && ip < in_end);

This is not a PHP bug but a libLZF bug, I see the same code in LZF-1.51 which is current as of this writing.
 [2006-07-05 20:12 UTC] mg at iceni dot pl
Thanks for the patch. I've uploaded fixed version of the 
LZF extension.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 15 20:01:29 2024 UTC