Re: Exceed file_size_limit .....?

[email protected] ("Sean M. Burke") Fri, 28 Mar 2003 18:32:33 -0900
Newsgroups perl.midi
Message-ID <[email protected]>
At 11:09 PM 2003-03-28 +0100, Markus Kollmar wrote:
>0060 b0 20 00 00 c0 63 00 ff  2f 00 f8 f8 f8 f8 f8 f8
>0070 f8 f8 f8 f8 f8 f8 f8 f8  f8 f8 f8 f8 f8 f8 f8 f8
>[...]reading track #3 (of length 4177066232) would exceed file_size_limit at


That's not a legal file ending according to the MIDI filespec -- so when
the code in MIDI::Opus sees that, it thinks "oh, this is a new chuck,
and apparently it's of type "\xf8\xf8\xf8\xf8", and is of length
0xf8f8f8f8 (4,177,066,232), etc. And since that's an insane length, it
aborts reading, with the error message you saw.

I've never seen a file like this before, but you can make MIDI/Opus.pm
silently accept that kind of file-ending by finding this line:

  my($id, $length, $format, $tracks_expected, $ticks) = unpack('A4Nnnn', $in);

and adding this line after it:

  last if $id eq "\xf8\xf8\xf8\xf8";

I think that'd do it.


By the way, what kind of things do you use MIDI-Perl for?  Composing new files; or archiving lots of existing MIDIs; or mixing MIDI data?

--
Sean M. Burke    http://search.cpan.org/~sburke/