Bug with MIDI type

Think you found a bug in getID3()? Post here with details.
Post Reply
cstadler18
User
Posts: 5
Joined: Tue Jun 18, 2013 6:28 pm
Are you a spambot?: no

Bug with MIDI type

Post by cstadler18 » Tue Jun 18, 2013 6:37 pm

Using latest release 1.9.6 (released Jun 03, 2013 : (with php 5.3.3) and Centos 6

http://www.midipedia.net/fichiers/midi/ ... is/Genesis Abacab.mid
Causes ID3 to just simply lock up and not return...
Help! Thanks, I also have a few examples from MP4 and MOV (Quicktime) that behave vary similarly let me know if you would like URLs for these also..

Thanks so much!
Craig

James Heinrich
getID3() v1 developer
Posts: 1433
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: Bug with MIDI type

Post by James Heinrich » Tue Jun 18, 2013 6:39 pm

I'll look at your sample file. Please also provide me samples of any other files that cause getID3 to hang.

James Heinrich
getID3() v1 developer
Posts: 1433
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: Bug with MIDI type

Post by James Heinrich » Tue Jun 18, 2013 6:56 pm

This file is truncated to 32kb (32768 bytes). The file header says there should be 22 tracks in the file but 32kB only gets about halfway through track #11, so only about half the file is there.

Nevertheless, getID3 should gracefully handle truncated files. This patch (around line 54 in module.audio.midi.php) should prevent it hanging and give a useful warning:

Code: Select all

while ((strlen($MIDIdata) - $offset) < 8) {
	if ($buffer = fread($this->getid3->fp, $this->getid3->fread_buffer_size())) {
		$MIDIdata .= $buffer;
	} else {
		$info['warning'][] = 'only processed '.($i - 1).' of '.$thisfile_midi_raw['tracks'].' tracks';
		$info['error'][] = 'Unabled to read more file data at '.ftell($this->getid3->fp).' (trying to seek to : '.$offset.'), was expecting at least 8 more bytes';
		return false;
	}
}
Full patched file attached, fix will be included in v1.9.7
Attachments
module.audio.midi.php
(18.54 KiB) Downloaded 2256 times

cstadler18
User
Posts: 5
Joined: Tue Jun 18, 2013 6:28 pm
Are you a spambot?: no

Re: Bug with MIDI type

Post by cstadler18 » Tue Jun 18, 2013 10:30 pm

http://walrus.wr.usgs.gov/tsunami/srila ... /pano1.mov also does the same. Thank you so much for your assistance and quick reply btw!!

cstadler18
User
Posts: 5
Joined: Tue Jun 18, 2013 6:28 pm
Are you a spambot?: no

Re: Bug with MIDI type

Post by cstadler18 » Wed Jun 19, 2013 12:37 am

Other media/urls that cause hangup :

MOV->

http://media.messe.ch/Messe/360/zurich-halle1.mov
http://walrus.wr.usgs.gov/tsunami/srilanka05/images/pano1.mov
http://www.akabak.net/38th_street.mov
http://video1.hobbico.com/gallery/dtx/dtxd14-360-view2.mov

MP4->
http://www.agapornis.narod.ru/video/fisheri_baby_birds3.3gp
http://www.mobile-review.com/review/image/sonyeric/t700/photo/video2.mp4
http://www.crosscolors.com/test/IndianaJones.mp4

Thank you!!

cstadler18
User
Posts: 5
Joined: Tue Jun 18, 2013 6:28 pm
Are you a spambot?: no

Re: Bug with MIDI type

Post by cstadler18 » Wed Jun 19, 2013 1:05 am

Last edited by James Heinrich on Wed Jun 19, 2013 4:34 pm, edited 2 times in total.
Reason: removed inappropriate content link

James Heinrich
getID3() v1 developer
Posts: 1433
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: Bug with MIDI type

Post by James Heinrich » Wed Jun 19, 2013 4:40 pm

Parses fine (0.041 seconds).
Parses fine (0.672 seconds). Does have an extraordinary number of entries (15123) under [asf][header_extension_object][extension_data_parsed][4][stream_names] so may take some time to render the page if you're displaying the analysis in a browser (e.g. demo.browse)
Parses fine (0.681 seconds). Does have an extraordinary number of entries (15123) under [asf][header_extension_object][extension_data_parsed][4][stream_names] so may take some time to render the page if you're displaying the analysis in a browser (e.g. demo.browse)

The last two files are both from Metacafe, I guess their encoder does weird (but legal) encoding things to put such a huge pile of (blank) stream names in the header.

But all 3 files do parse fine, and in under a second on my machine.

James Heinrich
getID3() v1 developer
Posts: 1433
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: Bug with MIDI type

Post by James Heinrich » Wed Jun 19, 2013 4:43 pm

cstadler18 wrote:http://walrus.wr.usgs.gov/tsunami/srila ... /pano1.mov also does the same.
Parses fine (0.049 seconds). Quicktime VR panorama.

James Heinrich
getID3() v1 developer
Posts: 1433
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: Bug with MIDI type

Post by James Heinrich » Wed Jun 19, 2013 4:48 pm

cstadler18 wrote:Other media/urls that cause hangup
I looked at all 7 URLs provided and none of them cause getID3 to hang.

cstadler18
User
Posts: 5
Joined: Tue Jun 18, 2013 6:28 pm
Are you a spambot?: no

Re: Bug with MIDI type

Post by cstadler18 » Sun Jun 30, 2013 4:18 am

Thanks, recently we saw this one lock up... does it work for you?

http://previews.imineo.com/lucky-luke-phil-de-fer_.wmv

James Heinrich
getID3() v1 developer
Posts: 1433
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: Bug with MIDI type

Post by James Heinrich » Sun Jun 30, 2013 10:47 am

cstadler18 wrote:Thanks, recently we saw this one lock up... does it work for you?
Works fine: File parsed in 0.051 seconds.

Post Reply