Coverity: Checked return: CID 582
authorNelson Ferreira <nelson.ferreira@ieee.org>
Fri, 13 Jan 2012 22:51:16 +0000 (17:51 -0500)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Fri, 13 Jan 2012 22:51:16 +0000 (17:51 -0500)
* src/media/media-internal.c (parsewave): Check the return of
waverequire, because we are trying to align the stream, but it may
still be fatal. Also fix the "flow" through of fatal error parsing
WAVE file in case wvSoundChuck which do not sound proper.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
src/media/media-internal.c

index 5ef4249..8d393aa 100644 (file)
@@ -251,17 +251,21 @@ static size_t parsewave(void **data, size_t * sz, void **outbuf)
                                        if (parsestate.wave.chunklength)
                                                parsestate.wave.state =
                                                    wvSkipChunk;
-                               } else if (rq)
+                               } else if (rq) {
                                        /* align data length to a multiple of datasize; keep additional data
                                           in "leftover" buffer --- this is necessary to ensure proper
                                           functioning of the sndcnv... routines */
-                                       waverequire(data, sz, rq);
-                               return (count);
+                                       if(waverequire(data, sz, rq) != 0)
+                                               return (count);
+                                       else
+                                               return 0;
+                               }
                        }
+                       break;
                case wvFatalNotify:
                        warn("Irrecoverable error while parsing WAVE file");
                        parsestate.wave.state = wvFatal;
-                       break;
+                       return 0;
                case wvFatal:
                default:
                        *sz = 0;