X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fadx.c;h=d941d7b89c56b51c82ac23527436bc1fb72c4887;hb=e61f39849c2e2b7f492c17b42058242ed2fa4d57;hp=870216c6061630f1399122e2abb0a3e6db27fdb4;hpb=1d9c2dc89a2302076a68b4a3ae3639abbb1a502d;p=ffmpeg diff --git a/libavcodec/adx.c b/libavcodec/adx.c index 870216c6061..d941d7b89c5 100644 --- a/libavcodec/adx.c +++ b/libavcodec/adx.c @@ -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,12 +48,12 @@ 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 */ if (buf[4] != 3 || buf[5] != 18 || buf[6] != 4) { - av_log_ask_for_sample(avctx, "unsupported ADX format\n"); + avpriv_request_sample(avctx, "Support for this ADX format"); return AVERROR_PATCHWELCOME; }