diff mbox series

[FFmpeg-devel,3/3] avformat/rcwtenc: Pass RCWTContext directly in rcwt_init_cluster()

Message ID AS8P250MB0744DDD3CAA7107B851CB2448F442@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 3371250c328857cb1b55f7a7f6e4bd0f566adcc4
Headers show
Series [FFmpeg-devel,1/3] avformat/rcwtenc: Fix potential out-of-bounds write | 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

Andreas Rheinhardt Feb. 8, 2024, 3:09 p.m. UTC
It does not use the AVFormatContext at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/rcwtenc.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Marth64 Feb. 9, 2024, 7:34 a.m. UTC | #1
v2 set LGTM. I verified with ATSC and DVD sources. Thank you.

On Thu, Feb 8, 2024 at 9:08 AM Andreas Rheinhardt <
andreas.rheinhardt@outlook.com> wrote:

> It does not use the AVFormatContext at all.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavformat/rcwtenc.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/libavformat/rcwtenc.c b/libavformat/rcwtenc.c
> index 084de6e205..7d57fcaf1e 100644
> --- a/libavformat/rcwtenc.c
> +++ b/libavformat/rcwtenc.c
> @@ -70,10 +70,8 @@ typedef struct RCWTContext {
>      uint8_t cluster_buf[RCWT_CLUSTER_MAX_BLOCKS * RCWT_BLOCK_SIZE];
>  } RCWTContext;
>
> -static void rcwt_init_cluster(AVFormatContext *avf)
> +static void rcwt_init_cluster(RCWTContext *rcwt)
>  {
> -    RCWTContext *rcwt = avf->priv_data;
> -
>      rcwt->cluster_pos = 0;
>      rcwt->cluster_pts = AV_NOPTS_VALUE;
>  }
> @@ -88,7 +86,7 @@ static void rcwt_flush_cluster(AVFormatContext *avf)
>          avio_write(avf->pb, rcwt->cluster_buf, rcwt->cluster_pos);
>      }
>
> -    rcwt_init_cluster(avf);
> +    rcwt_init_cluster(rcwt);
>  }
>
>  static int rcwt_write_header(AVFormatContext *avf)
> @@ -117,7 +115,7 @@ static int rcwt_write_header(AVFormatContext *avf)
>      avio_wb16(avf->pb, 0x000);
>      avio_w8(avf->pb, 0x00);
>
> -    rcwt_init_cluster(avf);
> +    rcwt_init_cluster(avf->priv_data);
>
>      return 0;
>  }
> --
> 2.34.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
diff mbox series

Patch

diff --git a/libavformat/rcwtenc.c b/libavformat/rcwtenc.c
index 084de6e205..7d57fcaf1e 100644
--- a/libavformat/rcwtenc.c
+++ b/libavformat/rcwtenc.c
@@ -70,10 +70,8 @@  typedef struct RCWTContext {
     uint8_t cluster_buf[RCWT_CLUSTER_MAX_BLOCKS * RCWT_BLOCK_SIZE];
 } RCWTContext;
 
-static void rcwt_init_cluster(AVFormatContext *avf)
+static void rcwt_init_cluster(RCWTContext *rcwt)
 {
-    RCWTContext *rcwt = avf->priv_data;
-
     rcwt->cluster_pos = 0;
     rcwt->cluster_pts = AV_NOPTS_VALUE;
 }
@@ -88,7 +86,7 @@  static void rcwt_flush_cluster(AVFormatContext *avf)
         avio_write(avf->pb, rcwt->cluster_buf, rcwt->cluster_pos);
     }
 
-    rcwt_init_cluster(avf);
+    rcwt_init_cluster(rcwt);
 }
 
 static int rcwt_write_header(AVFormatContext *avf)
@@ -117,7 +115,7 @@  static int rcwt_write_header(AVFormatContext *avf)
     avio_wb16(avf->pb, 0x000);
     avio_w8(avf->pb, 0x00);
 
-    rcwt_init_cluster(avf);
+    rcwt_init_cluster(avf->priv_data);
 
     return 0;
 }