Check the returned audio_buf_info fields
authormalc <malc@c046a42c-6fe2-441c-8c8c-71466251a162>
Sun, 8 Jun 2008 04:27:56 +0000 (04:27 +0000)
committermalc <malc@c046a42c-6fe2-441c-8c8c-71466251a162>
Sun, 8 Jun 2008 04:27:56 +0000 (04:27 +0000)
At least on one system zero is returned in either fragsize or
fragstotal (reported by Dave Scott), this results in an audio_calloc
failing the audio_bug check and another ominous error message. Fail
early and blame the system.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4699 c046a42c-6fe2-441c-8c8c-71466251a162

audio/ossaudio.c

index 2a300c21de7b3f7c9bd95e5487bfc718fee2ad1a..a29b4bc17212827b4574cc329bb98e7dbd918558 100644 (file)
@@ -254,6 +254,12 @@ static int oss_open (int in, struct oss_params *req,
         goto err;
     }
 
+    if (!abinfo.fragstotal || !abinfo.fragsize) {
+        AUD_log (AUDIO_CAP, "Returned bogus buffer information(%d, %d) for %s\n",
+                 abinfo.fragstotal, abinfo.fragsize, typ);
+        goto err;
+    }
+
     obt->fmt = fmt;
     obt->nchannels = nchannels;
     obt->freq = freq;