diff mbox series

[FFmpeg-devel] avcodec/mediacodecenc: Fix access of uninitialized value

Message ID tencent_5715C335B49868B6005D6AFE7ECEAE2A390A@qq.com
State New
Headers show
Series [FFmpeg-devel] avcodec/mediacodecenc: Fix access of uninitialized value | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Zhao Zhili Oct. 3, 2024, 5:30 p.m. UTC
From: Zhao Zhili <zhilizhao@tencent.com>

When crop is skipped, av_strlcatf will access `str` which isn't
initialized properly.
---
 libavcodec/mediacodecenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Matthieu Bouron Oct. 6, 2024, 7:28 a.m. UTC | #1
On Thu, Oct 3, 2024 at 7:31 PM Zhao Zhili <quinkblack@foxmail.com> wrote:
>
> From: Zhao Zhili <zhilizhao@tencent.com>
>
> When crop is skipped, av_strlcatf will access `str` which isn't
> initialized properly.
> ---
>  libavcodec/mediacodecenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c
> index 6ca3968a24..e76ea81236 100644
> --- a/libavcodec/mediacodecenc.c
> +++ b/libavcodec/mediacodecenc.c
> @@ -134,7 +134,7 @@ static int extract_extradata_support(AVCodecContext *avctx)
>  static int mediacodec_init_bsf(AVCodecContext *avctx)
>  {
>      MediaCodecEncContext *s = avctx->priv_data;
> -    char str[128];
> +    char str[128] = {0};
>      int ret;
>      int crop_right = s->width - avctx->width;
>      int crop_bottom = s->height - avctx->height;
> --
> 2.46.0

LGTM.
diff mbox series

Patch

diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c
index 6ca3968a24..e76ea81236 100644
--- a/libavcodec/mediacodecenc.c
+++ b/libavcodec/mediacodecenc.c
@@ -134,7 +134,7 @@  static int extract_extradata_support(AVCodecContext *avctx)
 static int mediacodec_init_bsf(AVCodecContext *avctx)
 {
     MediaCodecEncContext *s = avctx->priv_data;
-    char str[128];
+    char str[128] = {0};
     int ret;
     int crop_right = s->width - avctx->width;
     int crop_bottom = s->height - avctx->height;