]> git.mxchange.org Git - simgear.git/commitdiff
Try to prevent a crash in unusual situations
authorErik Hofman <erik@ehofman.com>
Mon, 18 Jul 2016 09:59:47 +0000 (11:59 +0200)
committerRoland Haeder <roland@mxchange.org>
Sat, 13 Aug 2016 08:21:16 +0000 (10:21 +0200)
simgear/sound/readwav.cxx

index 82135492382eaf42281b4647bef8175b75c1ea58..81b51b374436c7b9086e785a4b4358572261f676 100644 (file)
@@ -249,14 +249,14 @@ namespace
     
     bool found_header = false;
     bool compressed = false;
+    uint16_t bitsPerSample = 8;
+    uint16_t numChannels = 1;
     uint32_t chunkLength;
     int32_t magic;
     uint16_t audioFormat;
-    uint16_t numChannels;
     uint32_t samplesPerSecond;
     uint32_t byteRate;
     uint16_t blockAlign;
-    uint16_t bitsPerSample;
     Codec *codec = codecLinear;
 
     if (!wavReadBE(fd, magic))
@@ -310,7 +310,7 @@ namespace
                 } else {
                   bitsPerSample *= 2; /* uLaw is 16-bit packed into 8 bits */
                   codec = codecULaw;
-                }
Br                   }
                 break;
               case 17:         /* IMA4 ADPCM */
                 if (alIsExtensionPresent((ALchar *)"AL_EXT_ima4") &&