php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: valeriu at palos dot ro
New email:
PHP Version: OS:

 

 [2006-01-19 14:15 UTC] valeriu at palos dot ro
Description:
------------
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:
---------------
<?php
$UCdata='';  // create an uncompressed string
for($i=0;$i<10000;$i++)
$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!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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);

to:

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: Thu Mar 28 20:01:28 2024 UTC