Skip Menu |

This queue is for tickets about the Ogg-Vorbis-Header-PurePerl CPAN distribution.

Report information
The Basics
Id: 43693
Status: resolved
Priority: 0/
Queue: Ogg-Vorbis-Header-PurePerl

People
Owner: DAVECROSS [...] cpan.org
Requestors: NHEINRIC [...] cpan.org
Cc: gregoa [...] cpan.org
AdminCc:

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



Subject: Ogg::Vorbis::Header::PurePerl: Didn't find an ogg header - invalid file?
Running the test.pl that comes with the distribution causes warnings when calculating the track length of test.ogg. Length is reported as '0' as well. Adding a check like the following clears the warnings up: $len > $data->{'filesize'} and $len = $data->{'filesize'}; But length still reports '0'.
Subject: [rt.cpan.org #43693] patch
Date: Wed, 1 Apr 2009 23:54:27 +0200
To: bug-Ogg-Vorbis-Header-PurePerl [...] rt.cpan.org
From: gregor herrmann <gregoa [...] debian.org>
Download signature.asc
application/pgp-signature 197b

Message body not shown because it is not plain text.

Hi, please find attached a patch for this problem; it's a bit invasive but maybe it helps for improving this part of the code. Cheers, gregor, Debian Perl Group -- .''`. Home: http://info.comodo.priv.at/{,blog/} / GPG Key ID: 0x00F3CFE4 : :' : Debian GNU/Linux user, admin, & developer - http://www.debian.org/ `. `' Member of VIBE!AT, SPI Inc., fellow of FSFE | http://got.to/quote/ `- NP: Bob Dylan: Jokerman

Message body is not shown because sender requested not to inline it.

Here's an updated version of the patch, against 1.02 after the refactoring. I note two things: 1) t/02-basic.t passes in 1.01, but in 1.02, with the updated patch, it (still passes but) issues a warning: Use of uninitialized value in numeric eq (==) at t/02-basic.t line 36. and I don't see what else has changed … 2) In git the last test in t/02-basic.t is marked as TODO since a couple of days. Cheers, gregor
Subject: tracklength.patch
Description: - if the file is shorter than blocksize_0, the seek/read returns an empty $buf later - check for blocksize_0 is we are interested in blocksize_0 - seek (sic!) harder if OGGHEADERFLAG is not within $len Origin: vendor Bug: https://rt.cpan.org/Public/Bug/Display.html?id=43693 Forwarded: https://rt.cpan.org/Public/Bug/Display.html?id=43693 Bug-Debian: https://bugs.debian.org/522075 Author: gregor herrmann <gregoa@debian.org> Damyan Ivanov <dmn@debian.org> Last-Update: 2020-07-19 --- a/lib/Ogg/Vorbis/Header/PurePerl.pm +++ b/lib/Ogg/Vorbis/Header/PurePerl.pm @@ -420,30 +420,44 @@ sub _calculate_track_length { if (($data->{'filesize'} - $data->{'INFO'}{'offset'}) > ($data->{'INFO'}{'blocksize_0'} * 2)) { $len = $data->{'INFO'}{'blocksize_0'} * 2; + } elsif ($data->{'filesize'} < $data->{'INFO'}{'blocksize_0'}) { + $len = $data->{'filesize'}; } else { $len = $data->{'INFO'}{'blocksize_0'}; } - if ($len == 0) { + if ($data->{'INFO'}{'blocksize_0'} == 0) { print "Ogg::Vorbis::Header::PurePerl:\n"; warn "blocksize_0 is 0! Should be a power of 2! http://www.xiph.org/ogg/vorbis/doc/vorbis-spec-ref.html\n"; return; } seek($fh, -$len, 2); - read($fh, my $buf, $len); + my $buf = ''; my $found_header = 0; + my $block = $len; - for (my $i = 0; $i < $len; $i++) { + SEEK: + while ($found_header == 0 && read($fh, $buf, $len)) { + # search the last read $block bytes for Ogg header flag + # the search is conducted backwards so that the last flag + # is found first + for (my $i = $block; $i >= 0; $i--) { + if (substr($buf, $i, 4) eq OGGHEADERFLAG) { + substr($buf, 0, ($i+4), ''); + $found_header = 1; + last SEEK; + } + } - last if length($buf) < 4; + # already read the whole file? + last if $len == $data->{'filesize'}; - if (substr($buf, $i, 4) eq OGGHEADERFLAG) { - substr($buf, 0, ($i+4), ''); - $found_header = 1; - last; - } + $len += $block; + $len = $data->{'filesize'} if $len > $data->{'filesize'}; + + seek($fh, -$len, 2); } unless ($found_header) {
On Sun Jul 19 10:51:53 2020, GREGOA wrote: Show quoted text
> Here's an updated version of the patch, against 1.02 after the > refactoring. > > I note two things: > > 1) t/02-basic.t passes in 1.01, but in 1.02, with the updated patch, > it (still passes but) issues a warning: > > Use of uninitialized value in numeric eq (==) at t/02-basic.t line 36. > > and I don't see what else has changed … > > 2) In git the last test in t/02-basic.t is marked as TODO since a > couple of days.
Hi, Yes, thanks for that. I'd also noticed the new warning; I think I know what's causing it and I'll fix it sometime this week. The TODO is because I switched from using ok() to is() where appropriate and it broke a test that I need to now fix. Thanks for your input. Dave...
On Wed Apr 01 17:54:49 2009, gregoa@debian.org wrote: Show quoted text
> Hi, > > please find attached a patch for this problem; it's a bit invasive > but maybe it helps for improving this part of the code.
Oh, one other thing. Would it be easy for you to add your patch as a pull request against the Github repo at https://github.com/davorg/perl-ogg-vorbis-header-pureperl? No problem if not; I can do it myself. It would just be a little quicker, I expect. Dave...
Subject: Re: [rt.cpan.org #43693] Ogg::Vorbis::Header::PurePerl: Didn't find an ogg header - invalid file?
Date: Mon, 20 Jul 2020 18:08:10 +0200
To: bug-ogg-vorbis-header-pureperl [...] rt.cpan.org
From: gregor herrmann <gregoa [...] debian.org>
On Mon, 20 Jul 2020 07:20:53 -0400, Dave Cross via RT wrote: Show quoted text
> > please find attached a patch for this problem; it's a bit invasive > > but maybe it helps for improving this part of the code.
> Oh, one other thing. Would it be easy for you to add your patch as a pull request against the Github repo at https://github.com/davorg/perl-ogg-vorbis-header-pureperl?
Sure: https://github.com/davorg/perl-ogg-vorbis-header-pureperl/pull/1 And thanks for looking into this issue! Cheers, gregor -- .''`. https://info.comodo.priv.at -- Debian Developer https://www.debian.org : :' : OpenPGP fingerprint D1E1 316E 93A7 60A8 104D 85FA BB3A 6801 8649 AA06 `. `' Member VIBE!AT & SPI Inc. -- Supporter Free Software Foundation Europe `- NP: The Eagles: Desperado
Download signature.asc
application/pgp-signature 963b

Message body not shown because it is not plain text.

On Mon Jul 20 12:08:28 2020, gregoa@debian.org wrote: Show quoted text
> On Mon, 20 Jul 2020 07:20:53 -0400, Dave Cross via RT wrote: >
> > > please find attached a patch for this problem; it's a bit invasive > > > but maybe it helps for improving this part of the code.
> > Oh, one other thing. Would it be easy for you to add your patch as a > > pull request against the Github repo at > > https://github.com/davorg/perl-ogg-vorbis-header-pureperl?
> > Sure: > https://github.com/davorg/perl-ogg-vorbis-header-pureperl/pull/1 > > And thanks for looking into this issue!
Version 1.03 is currently en route to CPAN. Thanks for the patch. Dave...
Subject: Re: [rt.cpan.org #43693] Ogg::Vorbis::Header::PurePerl: Didn't find an ogg header - invalid file?
Date: Mon, 20 Jul 2020 23:29:52 +0200
To: bug-ogg-vorbis-header-pureperl [...] rt.cpan.org
From: gregor herrmann <gregoa [...] debian.org>
On Mon, 20 Jul 2020 13:28:41 -0400, Dave Cross via RT wrote: Show quoted text
> > Sure: > > https://github.com/davorg/perl-ogg-vorbis-header-pureperl/pull/1 > > > > And thanks for looking into this issue!
> > Version 1.03 is currently en route to CPAN. Thanks for the patch.
Thanks! And … uploaded to Debian as well. Cheers, gregor -- .''`. https://info.comodo.priv.at -- Debian Developer https://www.debian.org : :' : OpenPGP fingerprint D1E1 316E 93A7 60A8 104D 85FA BB3A 6801 8649 AA06 `. `' Member VIBE!AT & SPI Inc. -- Supporter Free Software Foundation Europe `- NP: Kurt Ostbahn & die Chefpartie
Download signature.asc
application/pgp-signature 963b

Message body not shown because it is not plain text.