Skip to content
This repository
Browse code

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
Anssi Hannula authored August 31, 2013

Showing 1 changed file with 4 additions and 0 deletions. Show diff stats Hide diff stats

  1. 4  lib/xbadpcm/ADPCMDll.cpp
4  lib/xbadpcm/ADPCMDll.cpp
@@ -47,6 +47,10 @@ extern "C"
47 47
     int     wavsize;
48 48
 
49 49
     wavsize = mywav_data(info->f, &info->fmt);
  50
+
  51
+    if (info->fmt.dwSamplesPerSec == 0 || info->fmt.wChannels == 0)
  52
+        return -1;
  53
+
50 54
     if(wavsize >= 0) {
51 55
         if(info->fmt.wFormatTag != 0x0069) {
52 56
             fseek(info->f,0,SEEK_SET);

0 notes on commit 983a388

Please sign in to comment.
Something went wrong with that request. Please try again.