Subject: wav: reject 0 bits per sample to avoid division by zero
From: Helmut Grohne <helmut () subdivi de>

--- a/src/wav.c
+++ b/src/wav.c
@@ -506,7 +506,7 @@
     unsigned short wChannels;       /* number of channels */
     uint32_t      dwSamplesPerSecond; /* samples per second per channel */
     uint32_t      dwAvgBytesPerSec;/* estimate of bytes per second needed */
-    uint16_t wBitsPerSample;  /* bits per sample */
+    uint16_t wBitsPerSample = 0;  /* bits per sample */
     uint32_t wFmtSize;
     uint16_t wExtSize = 0;    /* extended field for non-PCM */
 
@@ -954,6 +959,11 @@
         break;
 
     default:
+        if (ft->encoding.bits_per_sample == 0)
+        {
+            lsx_fail_errno(ft, SOX_EHDR, "WAV file bits per sample is zero");
+            return SOX_EOF;
+        }
         wav->numSamples = div_bits(qwDataLength, ft->encoding.bits_per_sample) / ft->signal.channels;
         ft->signal.length = wav->numSamples * ft->signal.channels;
     }
--- a/src/testall.sh
+++ b/src/testall.sh
@@ -67,3 +67,4 @@
 t vox -r 8130
 t wav
 t wve
+t wav -e gsm-full-rate