[Alsaplayer-devel]bug in wav_engine

Joshua Haberman joshua@haberman.com
Sat, 22 Dec 2001 03:58:09 -0600

Hello, alsaplayer developers!

I have come across a bug with alsaplayer's wav handling. Alsaplayer's
wav_engine will fail to recognize some valid wav files, due to an
incorrect assumption that the format chunk will always be 16 bytes long.
The problem is in this code:

In input/wav/formats.h:

typedef struct wav_header {
   u_int main_chunk; /* 'RIFF' */
   u_int length;     /* filelen */
   u_int chunk_type; /* 'WAVE' */

   u_int sub_chunk;  /* 'fmt ' */
   u_int sc_len;     /* length of sub_chunk, =16 */  <--- not necessarily!
   u_short format;      /* should be 1 for PCM-code */
   u_short modus;    /* 1 Mono, 2 Stereo */
   u_int sample_fq;  /* frequence of sample */
   u_int byte_p_sec;
   u_short byte_p_spl;  /* samplesize; 1 or 2 bytes */
   u_short bit_p_spl;   /* 8, 12 or 16 bit */

   u_int data_chunk; /* 'data' */
   u_int data_length;   /* samplecount */
} WaveHeader;

You need to read data_chunk and data_length from the correct offset in
the file, according to sc_len.


P.S. I tried sending this to alsaplayer-bugs@, as you request at
http://lists.tartarus.org/mailman/listinfo/alsaplayer-devel, but my mail
was rejected with this:


From: Mail Delivery System <Mailer-Daemon@ixion.tartarus.org>
Subject: Mail delivery failed: returning message to sender
Date: Sat, 22 Dec 2001 09:50:28 +0000

This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its
recipients. The following address(es) failed:

    (generated from alsaplayer-bugs@lists.tartarus.org):
    unknown local-part "alsaplayer" in domain "lists.tartarus.org"


Joshua Haberman  <joshua@haberman.com>