comparison pcm.c @ 7517:d4e19b465fcb libavcodec

Prevent DAUD PCM encoder from fetching values outside of ff_reverse[] array bounds when input sample values are < 0.
author pross
date Thu, 07 Aug 2008 08:16:42 +0000
parents 2f6a2fd238fb
children a40c76e98909
comparison
equal deleted inserted replaced
7516:11fe8c09948e 7517:d4e19b465fcb
207 case CODEC_ID_PCM_U24BE: 207 case CODEC_ID_PCM_U24BE:
208 encode_from16(3, 0, 1, &samples, &dst, n); 208 encode_from16(3, 0, 1, &samples, &dst, n);
209 break; 209 break;
210 case CODEC_ID_PCM_S24DAUD: 210 case CODEC_ID_PCM_S24DAUD:
211 for(;n>0;n--) { 211 for(;n>0;n--) {
212 uint32_t tmp = ff_reverse[*samples >> 8] + 212 uint32_t tmp = ff_reverse[(*samples >> 8) & 0xff] +
213 (ff_reverse[*samples & 0xff] << 8); 213 (ff_reverse[*samples & 0xff] << 8);
214 tmp <<= 4; // sync flags would go here 214 tmp <<= 4; // sync flags would go here
215 bytestream_put_be24(&dst, tmp); 215 bytestream_put_be24(&dst, tmp);
216 samples++; 216 samples++;
217 } 217 }