Bug 806373 - IO::Uncompress::Unzip->nextStream() does not return 0 at last ZIP stream
Summary: IO::Uncompress::Unzip->nextStream() does not return 0 at last ZIP stream
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: perl
Version: 6.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: perl-maint-list
QA Contact: Lukáš Zachar
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-03-23 15:09 UTC by Jan Holcapek
Modified: 2012-06-20 13:47 UTC (History)
4 users (show)

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.
Clone Of:
Environment:
Last Closed: 2012-06-20 13:47:45 UTC
Target Upstream Version:


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


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0843 0 normal SHIPPED_LIVE perl bug fix and enhancement update 2012-06-19 20:48:56 UTC

Description Jan Holcapek 2012-03-23 15:09:16 UTC
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 13:45:35 UTC
Created attachment 572755 [details]
Reproducer

This automated test gives up waiting for nextStream() cycle in 5 second.

Comment 3 Petr Pisar 2012-03-26 15:21:13 UTC
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 Program Management 2012-03-27 07:40:01 UTC
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 12:02:56 UTC
    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 12:36:29 UTC
    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 09:50:35 UTC
Thanks for pulling this in!

(In Czech: Diky, Petre!)

Comment 14 errata-xmlrpc 2012-06-20 13:47:45 UTC
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.