Bug 560438

Summary: fusecompress: lzo decompression fails on certain files
Product: [Fedora] Fedora Reporter: Tomas Hoger <thoger>
Component: fusecompressAssignee: Lubomir Rintel <lkundrak>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: rawhideCC: a.badger, lkundrak, lmacken
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: fusecompress-2.6-6.20100223git754bc0de.fc12 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-03-03 08:15:42 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tomas Hoger 2010-01-31 17:50:29 UTC
Description of problem:
fusecompress may fail to decompress lzo-compressed files it created.  The bug is caused by a following thinko in basic_lzo_decompressor::do_filter:

 93          while (true)
 94          {
 95              len = srcSize * 10;
 96 
 97              tmp.reserve(len);
 98              for (unsigned int i = 0; i < tmp.capacity(); ++i)
 99                 tmp.push_back(0);
100 
101              int ret;
102              if ((ret = lzo1x_decompress_safe((lzo_bytep) &src[0], src.size(),
103                                    (lzo_bytep) &tmp[0], &len, NULL)) == LZO_E_OUTPUT_OVERRUN) {
104 
105                 srcSize *= 2;
106                 continue;
107              }
108              break;
109          }

When decompressing a block of the compressed file, a buffer for uncompressed data is initially allocated to have 10-times the size of the input (95).  When that is insufficient (102), the size is doubled (105).  In that case, for loop (98) tries to initialize tmp.capacity() members of the vector, but fails to take into an account that tmp is non-empty, resulting in loop running until bad_alloc exception is raised.

Steps to Reproduce:
1. wget http://svn.easysw.com/public/cups/trunk/test/testfile.txt
2. fusecompress_offline -o fc_d,fc_c:lzo testfile.txt
3. fusecompress_offline -o fc_d testfile.txt

Outputs of the command can be found in the upstream bug:
https://developer.berlios.de/bugs/?func=detailbug&bug_id=16324&group_id=5384

Additional info:
Upstream git has this fixed already:
http://github.com/tex/fusecompress/commit/58a6785d54f88b0178f43adb6301423121cc4eb1

Comment 1 Fedora Update System 2010-02-23 22:56:20 UTC
fusecompress-2.6-6.20100223git754bc0de.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/fusecompress-2.6-6.20100223git754bc0de.fc13

Comment 2 Fedora Update System 2010-02-23 22:56:33 UTC
fusecompress-2.6-6.20100223git754bc0de.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/fusecompress-2.6-6.20100223git754bc0de.fc12

Comment 3 Toshio Ernie Kuratomi 2010-02-23 23:21:19 UTC
Snapshot built that should include the quoted fix.

Comment 4 Fedora Update System 2010-02-24 07:59:09 UTC
fusecompress-2.6-6.20100223git754bc0de.fc13 has been pushed to the Fedora 13 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update fusecompress'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F13/FEDORA-2010-2801

Comment 5 Fedora Update System 2010-02-26 03:41:28 UTC
fusecompress-2.6-6.20100223git754bc0de.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update fusecompress'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F12/FEDORA-2010-2951

Comment 6 Fedora Update System 2010-03-03 08:15:26 UTC
fusecompress-2.6-6.20100223git754bc0de.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 7 Fedora Update System 2010-03-04 00:20:15 UTC
fusecompress-2.6-6.20100223git754bc0de.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.