diff options
author | Mike Melanson <mike@multimedia.cx> | 2002-09-03 02:46:30 +0000 |
---|---|---|
committer | Mike Melanson <mike@multimedia.cx> | 2002-09-03 02:46:30 +0000 |
commit | 7eae2e17c207eb8b37f80e4ee2d7ccba2d28be0d (patch) | |
tree | 61176b3d62ed4d33ca1473e817706841380b7aab /src | |
parent | 8338bb48983b9f1990ec0c4ce1d1390a703afec1 (diff) | |
download | xine-lib-7eae2e17c207eb8b37f80e4ee2d7ccba2d28be0d.tar.gz xine-lib-7eae2e17c207eb8b37f80e4ee2d7ccba2d28be0d.tar.bz2 |
fix SMJPEG IMA so that it does not crash due to NULL pointer dereference
(but the audio still crackles)
CVS patchset: 2593
CVS date: 2002/09/03 02:46:30
Diffstat (limited to 'src')
-rw-r--r-- | src/libxineadec/adpcm.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/libxineadec/adpcm.c b/src/libxineadec/adpcm.c index 46ac42162..a4382157f 100644 --- a/src/libxineadec/adpcm.c +++ b/src/libxineadec/adpcm.c @@ -24,7 +24,7 @@ * formats can be found here: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: adpcm.c,v 1.11 2002/09/02 17:25:45 tmmm Exp $ + * $Id: adpcm.c,v 1.12 2002/09/03 02:46:30 tmmm Exp $ */ #include <stdio.h> @@ -156,12 +156,17 @@ static void decode_ima_nibbles(unsigned short *output, int delta; int channel_number = 0; + /* take care of the left */ step[0] = ima_adpcm_step[*index_l]; - step[1] = ima_adpcm_step[*index_r]; predictor[0] = *predictor_l; - predictor[1] = *predictor_r; index[0] = *index_l; - index[1] = *index_r; + + /* only handle the right if non-NULL pointers */ + if (index_r) { + step[1] = ima_adpcm_step[*index_r]; + predictor[1] = *predictor_r; + index[1] = *index_r; + } for (i = 0; i < output_size; i++) { delta = output[i]; @@ -192,9 +197,13 @@ static void decode_ima_nibbles(unsigned short *output, /* save the index and predictor values in case the calling function cares */ *predictor_l = predictor[0]; - *predictor_r = predictor[1]; *index_l = index[0]; - *index_r = index[1]; + + /* only save the right channel information if pointers are non-NULL */ + if (predictor_r) { + *predictor_r = predictor[1]; + *index_r = index[1]; + } } #define DK3_GET_NEXT_NIBBLE() \ |