Skip Menu |

This queue is for tickets about the MP3-Info CPAN distribution.

Report information
The Basics
Id: 101620
Status: open
Priority: 0/
Queue: MP3-Info

People
Owner: Nobody in particular
Requestors: timon [...] timon.net.nz
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: 1.26



Subject: Patch to fix an infinity loop in _get_v1tag
Module version: 1.24 Perl versions: 5.8.8 (also tested on 5.16 & 5.18) Loop "while (length($value))" may never ends if $value contains new line characters. This happens because "$" in s/(.)$// regex match the end of the string or _before_ newline at the end of the string. Example (value from real mp3 file): $ perl -lwe 'my $value = pack( "H*", "00cfad0a0ccfad0ab4000000586f770a" ); for ( 1 .. 10 ) { $value =~ s/(.)$//; print unpack( "H*", $value ) }' 00cfad0a0ccfad0ab4000000586f0a 00cfad0a0ccfad0ab4000000580a 00cfad0a0ccfad0ab40000000a 00cfad0a0ccfad0ab400000a 00cfad0a0ccfad0ab4000a 00cfad0a0ccfad0ab40a 00cfad0a0ccfad0a0a 00cfad0a0ccfad0a0a 00cfad0a0ccfad0a0a 00cfad0a0ccfad0a0a After replacing with substr(): $ perl -lwe 'my $value = pack( "H*", "00cfad0a0ccfad0ab4000000586f770a" ); for ( 1 .. 16 ) { substr $value, -1, 1, ""; print unpack( "H*", $value ) }' 00cfad0a0ccfad0ab4000000586f77 00cfad0a0ccfad0ab4000000586f 00cfad0a0ccfad0ab400000058 00cfad0a0ccfad0ab4000000 00cfad0a0ccfad0ab40000 00cfad0a0ccfad0ab400 00cfad0a0ccfad0ab4 00cfad0a0ccfad0a 00cfad0a0ccfad 00cfad0a0ccf 00cfad0a0c 00cfad0a 00cfad 00cf 00 Suggested patch attached.
Subject: Info.pm.patch
--- Info.pm.orig 2015-01-19 16:56:46.000000000 +0300 +++ Info.pm 2015-01-19 16:58:08.000000000 +0300 @@ -652,7 +652,7 @@ # Remove garbage and retry # (string is truncated in the # middle of a multibyte char?) - $value =~ s/(.)$//; + substr($value, -1, 1, ''); } }
Subject: Re: [rt.cpan.org #101620] Patch to fix an infinity loop in _get_v1tag
Date: Tue, 14 Jan 2020 16:29:39 +0300
To: bug-MP3-Info [...] rt.cpan.org
From: Aleksander Matveev <timon [...] timon.net.nz>
Status: resolved