Skip Menu |

This queue is for tickets about the IMAP-Client CPAN distribution.

Report information
The Basics
Id: 69791
Status: new
Priority: 0/
Queue: IMAP-Client

People
Owner: Nobody in particular
Requestors: olivierbrun2000 [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.13
Fixed in: (no value)



Subject: Bad message size in _imap_command function for FETCH and UID FETCH command
Incorrect calculation of the size of the message. To have a valid message size, in the _imap_command function, replace the line 915 : $datasize += length($resp) + 1; by this : $datasize += length($resp); This problem can generate bad behaviors in ok_response(): when the value of a line matches the pattern /\s+OK\s+/ See Bug #32072 and Bug #50004. To resolve the bug #32072 and bug #50004, I suggest also to modify the parse_fecth function to compute the size of the message before check the end of the message with ok_response function, like this : See code bellow : sub parse_fetch($@) { my ($self, @resp) = @_; ### Parse out fetch response into internal structure # Load up hash with fetch results (one entry per * tag FETCH) my %fetchsets; my $msgid = -1; my ($datasize,$datasizemax) = (0,0); foreach my $line (@resp) { if ($line =~ /^\* (\d+) FETCH \(.*\{(\d+)\}\s*$/gs) { $msgid = $1; $datasizemax = $2; $fetchsets{$msgid} .= $line; } elsif ( $datasizemax > 0 && $datasize >= $datasizemax ) { if( ok_response($line)) { $msgid = -1; # We Found the OK - This should be the end of the command } else { $self->throw_error("INTERNAL ERROR: No msgid set, but still trying to build fetchsets\n") if ($msgid < 0); $fetchsets{$msgid} .= $line; $datasize += length($line); } } else { $self->throw_error("INTERNAL ERROR: No msgid set, but still trying to build fetchsets\n") if ($msgid < 0); $fetchsets{$msgid} .= $line; $datasize += length($line); } } ...
Subject: Client.pm

Message body is not shown because it is too large.

Subject: Client.pm.diff
458a459 > my ($datasize,$datasizemax) = (0,0); 460c461 < if ($line =~ /^\* (\d+) FETCH \(/gs) { --- > if ($line =~ /^\* (\d+) FETCH \(.*\{(\d+)\}\s*$/gs) { 461a463 > $datasizemax = $2; 463,464c465,472 < } elsif (ok_response($line)) { < $msgid = -1; # We Found the OK - This should be the end of the command --- > } elsif ( $datasizemax > 0 && $datasize >= $datasizemax ) { > if( ok_response($line)) { > $msgid = -1; # We Found the OK - This should be the end of the command > } else { > $self->throw_error("INTERNAL ERROR: No msgid set, but still trying to build fetchsets\n") if ($msgid < 0); > $fetchsets{$msgid} .= $line; > $datasize += length($line); > } 467a476 > $datasize += length($line); 915c924 < $datasize += length($resp) + 1; --- > $datasize += length($resp);