Bug 806373 - IO::Uncompress::Unzip->nextStream() does not return 0 at last ZIP stream
IO::Uncompress::Unzip->nextStream() does not return 0 at last ZIP stream
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: perl (Show other bugs)
6.2
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: perl-maint-list
Lukas Zachar
: EasyFix
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-23 11:09 EDT by Jan Holcapek
Modified: 2012-06-20 09:47 EDT (History)
4 users (show)

See Also:
Fixed In Version: perl-5.10.1-126.el6
Doc Type: Bug Fix
Doc Text:
Cause Calling nextStream() method on IO::Uncompress::Unzip object with last stream in ZIP decoder. Consequence IO::Uncompress::Unzip::nextStream does not return 0 as documented which can change application code path. For example infinite cycle. Fix Fix from upstream version 2.030 has been back-ported. Result IO::Uncompress::Unzip::nextStream behaves as documented now.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-06-20 09:47:45 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Reproducer (812 bytes, text/plain)
2012-03-26 09:45 EDT, Petr Pisar
no flags Details

  None (edit)
Description Jan Holcapek 2012-03-23 11:09:16 EDT
Description of problem:

Perl module IO::Uncompress::Unzip version 2.020, which is part of
perl-IO-Compress-Zlib package, which in turn is built out of perl SRPM,
has an annoying bug in nextStream method, see
http://compgroups.net/comp.lang.perl.misc/Bug-in-IO-Uncompress-Unzip-nextStream

The bug is known to be fixed in IO::Uncompress::Unzip version 2.030.


Version-Release number of selected component (if applicable):
perl-5.10.1
perl-IO-Compress-Zlib-2.020


How reproducible:
Always


Steps to Reproduce:
perl -MIO::Uncompress::Unzip -e '$q = IO::Uncompress::Unzip->new("foo.zip"); while ($q->nextStream) { }'

Actual results:
Endless loop since nextStream always returns 1.


Expected results:
nextStream should return 0 after the last stream was found,
and thus the loop should end.

Additional info:
Comment 2 Petr Pisar 2012-03-26 09:45:35 EDT
Created attachment 572755 [details]
Reproducer

This automated test gives up waiting for nextStream() cycle in 5 second.
Comment 3 Petr Pisar 2012-03-26 11:21:13 EDT
This is working fix from 2.030:

--- IO-Compress-2.027/lib/IO/Uncompress/Base.pm 2010-04-24 11:42:55.000000000 +0200
+++ IO-Compress-2.030/lib/IO/Uncompress/Base.pm 2010-07-24 13:49:13.000000000 +0200
@@ -980,7 +980,7 @@
     #*$self->{EndStream} = 0 ;
 
     if ( ! defined $magic) {
-        if (! *$self->{Transparent} )
+        if (! *$self->{Transparent} || $self->eof())
         {
             *$self->{EndStream} = 1 ;
             return 0;

No rebase is needed. I will prepare patch against big perl source package.
Comment 5 RHEL Product and Program Management 2012-03-27 03:40:01 EDT
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux maintenance release. Product Management has 
requested further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed 
products. This request is not yet committed for inclusion in an Update release.
Comment 7 Petr Pisar 2012-03-27 08:02:56 EDT
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause
    Running IO::Uncompress::Unzip->nextStream() on last ZIP stream.
Consequence
    IO::Uncompress::Unzip::nextStream does not return 0 as
    documented which can change application code path. For example
    infinite cycle.
Fix
    Fix from upstream version 2.030 has been back-ported.
Result
    IO::Uncompress::Unzip::nextStream behaves as documented now.
Comment 9 Petr Pisar 2012-03-27 08:36:29 EDT
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,5 +1,6 @@
 Cause
-    Running IO::Uncompress::Unzip->nextStream() on last ZIP stream.
+    Calling nextStream() method on IO::Uncompress::Unzip object
+    with last stream in ZIP decoder.
 Consequence
     IO::Uncompress::Unzip::nextStream does not return 0 as
     documented which can change application code path. For example
Comment 12 Jan Holcapek 2012-04-06 05:50:35 EDT
Thanks for pulling this in!

(In Czech: Diky, Petre!)
Comment 14 errata-xmlrpc 2012-06-20 09:47:45 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0843.html

Note You need to log in before you can comment on or make changes to this bug.