From 983a3884fa17880599021434a929163acea5399f Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Sat, 31 Aug 2013 11:30:32 +0300 Subject: 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. --- lib/xbadpcm/ADPCMDll.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/xbadpcm') 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); -- cgit v1.2.3