[FFmpeg-devel] [PATCH] avcodec/speexdec: limit max frame_size

slbtty shenlebantongying at gmail.com
Wed Jan 29 03:31:14 EET 2025


Correction: this fix the sample from #11054 but not #11078.

Still trying to figure out why.


> On Jan 28, 2025, at 8:21 PM, shenleban tongying <shenlebantongying at gmail.com> wrote:
> 
> The max frame_size for speex format is 32000 Hz * 20 ms / 1000 ms = 640
> 
> close #11054 and #11078
> 
> Signed-off-by: shenleban tongying <shenlebantongying at gmail.com>
> ---
> libavcodec/speexdec.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/speexdec.c b/libavcodec/speexdec.c
> index d25823ef6e..555012a343 100644
> --- a/libavcodec/speexdec.c
> +++ b/libavcodec/speexdec.c
> @@ -1425,7 +1425,7 @@ static int parse_speex_extradata(AVCodecContext *avctx,
>    if (s->frame_size < NB_FRAME_SIZE << (s->mode > 0) ||
>        s->frame_size >     INT32_MAX >> (s->mode > 0))
>        return AVERROR_INVALIDDATA;
> -    s->frame_size <<= (s->mode > 0);
> +    s->frame_size = FFMIN(640, s->frame_size << (s->mode > 0));
>    s->vbr = bytestream_get_le32(&buf);
>    s->frames_per_packet = bytestream_get_le32(&buf);
>    if (s->frames_per_packet <= 0 ||
> -- 
> 2.48.1
> 



More information about the ffmpeg-devel mailing list