aboutsummaryrefslogtreecommitdiff
path: root/lib/xbadpcm
diff options
context:
space:
mode:
authorAnssi Hannula <anssi@xbmc.org>2013-08-31 11:30:32 +0300
committerAnssi Hannula <anssi@xbmc.org>2013-08-31 11:33:21 +0300
commit983a3884fa17880599021434a929163acea5399f (patch)
treeb9e976db7e495ff9cf2434fbcaaa3eb693703ff2 /lib/xbadpcm
parent991fb671bf84bb112651f3c625ad7beb64f2a2f0 (diff)
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.
Diffstat (limited to 'lib/xbadpcm')
-rw-r--r--lib/xbadpcm/ADPCMDll.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/xbadpcm/ADPCMDll.cpp b/lib/xbadpcm/ADPCMDll.cpp
index 67e27e5e50..b0dab8987c 100644
--- a/lib/xbadpcm/ADPCMDll.cpp
+++ b/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);