Skip to content

Commit 0bb0e32

Browse files
committed
WAVe decodeHeader error handling
1 parent f52e98d commit 0bb0e32

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/AudioCodecs/CodecWAV.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,16 +377,18 @@ class WAVDecoder : public AudioDecoder {
377377
);
378378
}
379379

380-
380+
/// Decodes the header data: Returns the start pos of the data
381381
int decodeHeader(uint8_t *in_ptr, size_t in_size) {
382382
int result = in_size;
383383
// we expect at least the full header
384384
int written = header.write(in_ptr, in_size);
385385
if (!header.isDataComplete()) {
386-
return written;
386+
return 0;
387387
}
388388
// parse header
389-
header.parse();
389+
if (!header.parse()){
390+
return 0;
391+
}
390392

391393
isFirst = false;
392394
isValid = header.audioInfo().is_valid;

0 commit comments

Comments
 (0)