]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/adx.c
asfdec: make nb_sub to be unsigned int
[ffmpeg] / libavcodec / adx.c
index 63358650ed03a51ee269e29d7f3bc2ab571a2996..d941d7b89c56b51c82ac23527436bc1fb72c4887 100644 (file)
@@ -35,8 +35,8 @@ void ff_adx_calculate_coeffs(int cutoff, int sample_rate, int bits, int *coeff)
     coeff[1] = lrintf(-(c * c) * (1 << bits));
 }
 
-int avpriv_adx_decode_header(AVCodecContext *avctx, const uint8_t *buf,
-                             int bufsize, int *header_size, int *coeff)
+int ff_adx_decode_header(AVCodecContext *avctx, const uint8_t *buf,
+                         int bufsize, int *header_size, int *coeff)
 {
     int offset, cutoff;
 
@@ -48,7 +48,7 @@ int avpriv_adx_decode_header(AVCodecContext *avctx, const uint8_t *buf,
     offset = AV_RB16(buf + 2) + 4;
 
     /* if copyright string is within the provided data, validate it */
-    if (bufsize >= offset && memcmp(buf + offset - 6, "(c)CRI", 6))
+    if (bufsize >= offset && offset >= 6 && memcmp(buf + offset - 6, "(c)CRI", 6))
         return AVERROR_INVALIDDATA;
 
     /* check for encoding=3 block_size=18, sample_size=4 */