* [FFmpeg-devel] [PATCH v3] libavcodec/cbs_av1: Add size check before parse obu
@ 2022-08-17 2:51 Wenbin Chen
2022-08-24 5:18 ` Chen, Wenbin
2022-09-21 8:27 ` Xiang, Haihao
0 siblings, 2 replies; 5+ messages in thread
From: Wenbin Chen @ 2022-08-17 2:51 UTC (permalink / raw)
To: ffmpeg-devel
cbs_av1_write_unit() check pbc size after parsing obu frame, and return
AVERROR(ENOSPC) if pbc is small. pbc will be reallocated and this obu
frame will be parsed again, but this may cause error because
CodedBitstreamAV1Context has already been updated, for example
ref_order_hint is updated and will not match the same obu frame. Now size
check is added before parsing obu frame to avoid this error.
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
---
libavcodec/cbs_av1.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
index 154d9156cf..9c51a8c7c8 100644
--- a/libavcodec/cbs_av1.c
+++ b/libavcodec/cbs_av1.c
@@ -1075,6 +1075,9 @@ static int cbs_av1_write_obu(CodedBitstreamContext *ctx,
put_bits32(pbc, 0);
}
+ if (8 * (unit->data_size + obu->obu_size) > put_bits_left(pbc))
+ return AVERROR(ENOSPC);
+
td = NULL;
start_pos = put_bits_count(pbc);
--
2.32.0
_______________________________________________
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".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH v3] libavcodec/cbs_av1: Add size check before parse obu
2022-08-17 2:51 [FFmpeg-devel] [PATCH v3] libavcodec/cbs_av1: Add size check before parse obu Wenbin Chen
@ 2022-08-24 5:18 ` Chen, Wenbin
2022-09-06 1:35 ` Chen, Wenbin
2022-09-21 8:27 ` Xiang, Haihao
1 sibling, 1 reply; 5+ messages in thread
From: Chen, Wenbin @ 2022-08-24 5:18 UTC (permalink / raw)
To: FFmpeg development discussions and patches
> cbs_av1_write_unit() check pbc size after parsing obu frame, and return
> AVERROR(ENOSPC) if pbc is small. pbc will be reallocated and this obu
> frame will be parsed again, but this may cause error because
> CodedBitstreamAV1Context has already been updated, for example
> ref_order_hint is updated and will not match the same obu frame. Now size
> check is added before parsing obu frame to avoid this error.
>
> Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
> ---
> libavcodec/cbs_av1.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
> index 154d9156cf..9c51a8c7c8 100644
> --- a/libavcodec/cbs_av1.c
> +++ b/libavcodec/cbs_av1.c
> @@ -1075,6 +1075,9 @@ static int
> cbs_av1_write_obu(CodedBitstreamContext *ctx,
> put_bits32(pbc, 0);
> }
>
> + if (8 * (unit->data_size + obu->obu_size) > put_bits_left(pbc))
> + return AVERROR(ENOSPC);
> +
> td = NULL;
> start_pos = put_bits_count(pbc);
>
> --
> 2.32.0
Ping
>
> _______________________________________________
> 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".
_______________________________________________
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".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH v3] libavcodec/cbs_av1: Add size check before parse obu
2022-08-24 5:18 ` Chen, Wenbin
@ 2022-09-06 1:35 ` Chen, Wenbin
0 siblings, 0 replies; 5+ messages in thread
From: Chen, Wenbin @ 2022-09-06 1:35 UTC (permalink / raw)
To: FFmpeg development discussions and patches
> > cbs_av1_write_unit() check pbc size after parsing obu frame, and return
> > AVERROR(ENOSPC) if pbc is small. pbc will be reallocated and this obu
> > frame will be parsed again, but this may cause error because
> > CodedBitstreamAV1Context has already been updated, for example
> > ref_order_hint is updated and will not match the same obu frame. Now
> size
> > check is added before parsing obu frame to avoid this error.
> >
> > Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
> > ---
> > libavcodec/cbs_av1.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
> > index 154d9156cf..9c51a8c7c8 100644
> > --- a/libavcodec/cbs_av1.c
> > +++ b/libavcodec/cbs_av1.c
> > @@ -1075,6 +1075,9 @@ static int
> > cbs_av1_write_obu(CodedBitstreamContext *ctx,
> > put_bits32(pbc, 0);
> > }
> >
> > + if (8 * (unit->data_size + obu->obu_size) > put_bits_left(pbc))
> > + return AVERROR(ENOSPC);
> > +
> > td = NULL;
> > start_pos = put_bits_count(pbc);
> >
> > --
> > 2.32.0
>
> Ping
Ping
>
> >
> > _______________________________________________
> > 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".
> _______________________________________________
> 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".
_______________________________________________
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".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH v3] libavcodec/cbs_av1: Add size check before parse obu
2022-08-17 2:51 [FFmpeg-devel] [PATCH v3] libavcodec/cbs_av1: Add size check before parse obu Wenbin Chen
2022-08-24 5:18 ` Chen, Wenbin
@ 2022-09-21 8:27 ` Xiang, Haihao
2022-09-21 9:30 ` Chen, Wenbin
1 sibling, 1 reply; 5+ messages in thread
From: Xiang, Haihao @ 2022-09-21 8:27 UTC (permalink / raw)
To: ffmpeg-devel
> cbs_av1_write_unit() check pbc size after parsing obu frame, and return
It is cbs_av1_write_obu(), not cbs_av1_write_unit(), right ?
Thanks
Haihao
> AVERROR(ENOSPC) if pbc is small. pbc will be reallocated and this obu
> frame will be parsed again, but this may cause error because
> CodedBitstreamAV1Context has already been updated, for example
> ref_order_hint is updated and will not match the same obu frame. Now size
> check is added before parsing obu frame to avoid this error.
>
> Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
> ---
> libavcodec/cbs_av1.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
> index 154d9156cf..9c51a8c7c8 100644
> --- a/libavcodec/cbs_av1.c
> +++ b/libavcodec/cbs_av1.c
> @@ -1075,6 +1075,9 @@ static int cbs_av1_write_obu(CodedBitstreamContext *ctx,
> put_bits32(pbc, 0);
> }
>
> + if (8 * (unit->data_size + obu->obu_size) > put_bits_left(pbc))
> + return AVERROR(ENOSPC);
> +
> td = NULL;
> start_pos = put_bits_count(pbc);
>
_______________________________________________
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".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH v3] libavcodec/cbs_av1: Add size check before parse obu
2022-09-21 8:27 ` Xiang, Haihao
@ 2022-09-21 9:30 ` Chen, Wenbin
0 siblings, 0 replies; 5+ messages in thread
From: Chen, Wenbin @ 2022-09-21 9:30 UTC (permalink / raw)
To: FFmpeg development discussions and patches
> > cbs_av1_write_unit() check pbc size after parsing obu frame, and return
>
> It is cbs_av1_write_obu(), not cbs_av1_write_unit(), right ?
>
> Thanks
> Haihao
>
Sorry, it is typo. cbs_av1_write_obu is assigned to write_unit function pointer.
I will fix it and resubmit patch.
Thanks
Wenbin
>
> > AVERROR(ENOSPC) if pbc is small. pbc will be reallocated and this obu
> > frame will be parsed again, but this may cause error because
> > CodedBitstreamAV1Context has already been updated, for example
> > ref_order_hint is updated and will not match the same obu frame. Now
> size
> > check is added before parsing obu frame to avoid this error.
> >
> > Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
> > ---
> > libavcodec/cbs_av1.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
> > index 154d9156cf..9c51a8c7c8 100644
> > --- a/libavcodec/cbs_av1.c
> > +++ b/libavcodec/cbs_av1.c
> > @@ -1075,6 +1075,9 @@ static int
> cbs_av1_write_obu(CodedBitstreamContext *ctx,
> > put_bits32(pbc, 0);
> > }
> >
> > + if (8 * (unit->data_size + obu->obu_size) > put_bits_left(pbc))
> > + return AVERROR(ENOSPC);
> > +
> > td = NULL;
> > start_pos = put_bits_count(pbc);
> >
> _______________________________________________
> 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".
_______________________________________________
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".
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-09-21 9:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-17 2:51 [FFmpeg-devel] [PATCH v3] libavcodec/cbs_av1: Add size check before parse obu Wenbin Chen
2022-08-24 5:18 ` Chen, Wenbin
2022-09-06 1:35 ` Chen, Wenbin
2022-09-21 8:27 ` Xiang, Haihao
2022-09-21 9:30 ` Chen, Wenbin
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git