[FFmpeg-devel] [PATCH] libfdk-aacenc: Actually check for upper bounds of cutoff

Michael Niedermayer michaelni at gmx.at
Sat Feb 9 22:47:14 CET 2013


On Sat, Feb 09, 2013 at 02:43:12PM -0500, Derek Buitenhuis wrote:
> Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> ---
> I am assuming it is possible for avctx->cutoff to be >20000. If you
> do 'avconv -cutoff 20000', no warnings about clipping appear, so either
> it clips silently (evil) or this patch is needed.
> ---
>  libavcodec/libfdk-aacenc.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
> index 06576aa..d76b215 100644
> --- a/libavcodec/libfdk-aacenc.c
> +++ b/libavcodec/libfdk-aacenc.c
> @@ -250,7 +250,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
>      }
>  
>      if (avctx->cutoff > 0) {
> -        if (avctx->cutoff < (avctx->sample_rate + 255) >> 8) {
> +        if (avctx->cutoff < (avctx->sample_rate + 255) >> 8 || avctx->cutoff > 20000) {
>              av_log(avctx, AV_LOG_ERROR, "cutoff valid range is %d-20000\n",
>                     (avctx->sample_rate + 255) >> 8);
>              goto error;

if libfdk-aacenc needs these explicit checks then sure patch ok
but please use the correct tool name in the commit message.

besides this, IMHO its libfdk-aacencs job to check such parameters
its non ideal to hardcode such numbers in user applications

also you have a off by 1 error in there somewhere as the commit
message says talks about 20000 with no warnings while the code looks
like it would only start having an issue with 20001


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130209/67568e55/attachment.asc>


More information about the ffmpeg-devel mailing list