Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

xbadpcm: fix crash on invalid input file

If the sample rate or channel count is zero on a file opened with
ADPCMDll, a division by zero is performed causing XBMC to crash.

Fix that by adding the necessary check.
  • Loading branch information...
commit 983a3884fa17880599021434a929163acea5399f 1 parent 991fb67
@anssih anssih authored
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/xbadpcm/ADPCMDll.cpp
View
4 lib/xbadpcm/ADPCMDll.cpp
@@ -47,6 +47,10 @@ extern "C"
int wavsize;
wavsize = mywav_data(info->f, &info->fmt);
+
+ if (info->fmt.dwSamplesPerSec == 0 || info->fmt.wChannels == 0)
+ return -1;
+
if(wavsize >= 0) {
if(info->fmt.wFormatTag != 0x0069) {
fseek(info->f,0,SEEK_SET);
Please sign in to comment.
Something went wrong with that request. Please try again.