launchpadinteractive / popforge

Automatically exported from code.google.com/p/popforge
0 stars 0 forks source link

WavDecoder parse exception for "bad" fmt chunks. #7

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
(Discovered using QueueLoader's PCMSoundItem playback functionality)
1.  Load the attached wav file in and listen for onComplete event
2.  grab the ByteArray from the stream and pass into WavFormat.decode
3. Wait for exception

What is the expected output? What do you see instead?
Should parse the Wav header.
Throws an exception because "data" variable ends up as null.

What version of the product are you using? On what operating system?
Version supplied with QueueLoader v 3.1.0
http://code.google.com/p/queueloader-as3/
But checked SVN version of file.

Please provide any additional information below.

http://popforge.googlecode.com/svn/trunk/flash/PopforgeLibrary/src/de/popforge/f
ormat/wav/WavDecoder.as

in parse function, you are not advancing the byte pointer when you read the
format chunk.  If format chunk is not formed according to expected, it
never finds the data chunk - see attached file.

Fix:
//set at end of while loop rather than in switch.
bytes.position = position + length;

After while loop, you should also test if data is undefined / null...

Original issue reported on code.google.com by glengine...@gmail.com on 14 Sep 2009 at 10:57

Attachments: