Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 2/4] avcodec/hevc_parse: check the size of hvcC is at least 23
       [not found] <20230613073718.675388-1-quinkblack@foxmail.com>
@ 2023-06-13  7:37 ` Zhao Zhili
  2023-06-13 14:10   ` Lance Wang
  2023-06-13  7:37 ` [FFmpeg-devel] [PATCH 3/4] avformat/asfdec_f: support bmp_tags_unofficial Zhao Zhili
  2023-06-13  7:37 ` [FFmpeg-devel] [PATCH 4/4] avformat/asfdec_f: fix need_parsing flag for codec mpeg4 Zhao Zhili
  2 siblings, 1 reply; 5+ messages in thread
From: Zhao Zhili @ 2023-06-13  7:37 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Zhao Zhili

From: Zhao Zhili <zhilizhao@tencent.com>

The code after the check skip 21 bytes and then read two bytes.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
---
 libavcodec/hevc_parse.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/hevc_parse.c b/libavcodec/hevc_parse.c
index 1f3beed183..7bc28fd081 100644
--- a/libavcodec/hevc_parse.c
+++ b/libavcodec/hevc_parse.c
@@ -88,8 +88,10 @@ int ff_hevc_decode_extradata(const uint8_t *data, int size, HEVCParamSets *ps,
 
     /* data[0] == 1 is configurationVersion from 14496-15.
      * data[0] == 0 is for backward compatibility predates the standard.
+     *
+     * Minimum number of bytes of hvcC with 0 numOfArrays is 23.
      */
-    if (size > 3 && ((data[0] == 1) || (data[0] == 0 && (data[1] || data[2] > 1)))) {
+    if (size >= 23 && ((data[0] == 1) || (data[0] == 0 && (data[1] || data[2] > 1)))) {
         /* It seems the extradata is encoded as hvcC format. */
         int i, j, num_arrays, nal_len_size;
 
-- 
2.25.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".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [FFmpeg-devel] [PATCH 3/4] avformat/asfdec_f: support bmp_tags_unofficial
       [not found] <20230613073718.675388-1-quinkblack@foxmail.com>
  2023-06-13  7:37 ` [FFmpeg-devel] [PATCH 2/4] avcodec/hevc_parse: check the size of hvcC is at least 23 Zhao Zhili
@ 2023-06-13  7:37 ` Zhao Zhili
  2023-06-13  7:37 ` [FFmpeg-devel] [PATCH 4/4] avformat/asfdec_f: fix need_parsing flag for codec mpeg4 Zhao Zhili
  2 siblings, 0 replies; 5+ messages in thread
From: Zhao Zhili @ 2023-06-13  7:37 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Zhao Zhili

From: Zhao Zhili <zhilizhao@tencent.com>

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
---
 libavformat/asfdec_f.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c
index bdbd4271c8..1e3eb33fd6 100644
--- a/libavformat/asfdec_f.c
+++ b/libavformat/asfdec_f.c
@@ -445,6 +445,8 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
 
         st->codecpar->codec_tag = tag1;
         st->codecpar->codec_id  = ff_codec_get_id(ff_codec_bmp_tags, tag1);
+        if (!st->codecpar->codec_id)
+            st->codecpar->codec_id = ff_codec_get_id(ff_codec_bmp_tags_unofficial, tag1);
         if (tag1 == MKTAG('D', 'V', 'R', ' ')) {
             sti->need_parsing = AVSTREAM_PARSE_FULL;
             /* issue658 contains wrong w/h and MS even puts a fake seq header
@@ -459,6 +461,8 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
             sti->need_parsing = AVSTREAM_PARSE_FULL_ONCE;
         if (st->codecpar->codec_id == AV_CODEC_ID_MPEG4)
             sti->need_parsing = AVSTREAM_PARSE_FULL_ONCE;
+        if (st->codecpar->codec_id == AV_CODEC_ID_HEVC)
+            sti->need_parsing = AVSTREAM_PARSE_FULL;
     }
     pos2 = avio_tell(pb);
     avio_skip(pb, size - (pos2 - pos1 + 24));
-- 
2.25.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".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [FFmpeg-devel] [PATCH 4/4] avformat/asfdec_f: fix need_parsing flag for codec mpeg4
       [not found] <20230613073718.675388-1-quinkblack@foxmail.com>
  2023-06-13  7:37 ` [FFmpeg-devel] [PATCH 2/4] avcodec/hevc_parse: check the size of hvcC is at least 23 Zhao Zhili
  2023-06-13  7:37 ` [FFmpeg-devel] [PATCH 3/4] avformat/asfdec_f: support bmp_tags_unofficial Zhao Zhili
@ 2023-06-13  7:37 ` Zhao Zhili
  2 siblings, 0 replies; 5+ messages in thread
From: Zhao Zhili @ 2023-06-13  7:37 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Zhao Zhili

From: Zhao Zhili <zhilizhao@tencent.com>

AVSTREAM_PARSE_FULL_ONCE is only implemented for H.264.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
---
 libavformat/asfdec_f.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c
index 1e3eb33fd6..5405956467 100644
--- a/libavformat/asfdec_f.c
+++ b/libavformat/asfdec_f.c
@@ -460,7 +460,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
         if (st->codecpar->codec_id == AV_CODEC_ID_H264)
             sti->need_parsing = AVSTREAM_PARSE_FULL_ONCE;
         if (st->codecpar->codec_id == AV_CODEC_ID_MPEG4)
-            sti->need_parsing = AVSTREAM_PARSE_FULL_ONCE;
+            sti->need_parsing = AVSTREAM_PARSE_FULL;
         if (st->codecpar->codec_id == AV_CODEC_ID_HEVC)
             sti->need_parsing = AVSTREAM_PARSE_FULL;
     }
-- 
2.25.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".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH 2/4] avcodec/hevc_parse: check the size of hvcC is at least 23
  2023-06-13  7:37 ` [FFmpeg-devel] [PATCH 2/4] avcodec/hevc_parse: check the size of hvcC is at least 23 Zhao Zhili
@ 2023-06-13 14:10   ` Lance Wang
  2023-06-13 17:11     ` Zhao Zhili
  0 siblings, 1 reply; 5+ messages in thread
From: Lance Wang @ 2023-06-13 14:10 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Tue, Jun 13, 2023 at 3:37 PM Zhao Zhili <quinkblack@foxmail.com> wrote:

> From: Zhao Zhili <zhilizhao@tencent.com>
>
> The code after the check skip 21 bytes and then read two bytes.
>
> Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
> ---
>  libavcodec/hevc_parse.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/hevc_parse.c b/libavcodec/hevc_parse.c
> index 1f3beed183..7bc28fd081 100644
> --- a/libavcodec/hevc_parse.c
> +++ b/libavcodec/hevc_parse.c
> @@ -88,8 +88,10 @@ int ff_hevc_decode_extradata(const uint8_t *data, int
> size, HEVCParamSets *ps,
>
>      /* data[0] == 1 is configurationVersion from 14496-15.
>       * data[0] == 0 is for backward compatibility predates the standard.
> +     *
> +     * Minimum number of bytes of hvcC with 0 numOfArrays is 23.
>       */
> -    if (size > 3 && ((data[0] == 1) || (data[0] == 0 && (data[1] ||
> data[2] > 1)))) {
> +    if (size >= 23 && ((data[0] == 1) || (data[0] == 0 && (data[1] ||
> data[2] > 1)))) {
>

I think it's better to move the size checking before 21 byte are skipped,
or it'll go to the else logic which
is different.

         /* It seems the extradata is encoded as hvcC format. */
>          int i, j, num_arrays, nal_len_size;
>
> --
> 2.25.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".
>
_______________________________________________
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 2/4] avcodec/hevc_parse: check the size of hvcC is at least 23
  2023-06-13 14:10   ` Lance Wang
@ 2023-06-13 17:11     ` Zhao Zhili
  0 siblings, 0 replies; 5+ messages in thread
From: Zhao Zhili @ 2023-06-13 17:11 UTC (permalink / raw)
  To: 'FFmpeg development discussions and patches'



> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Lance Wang
> Sent: 2023年6月13日 22:10
> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH 2/4] avcodec/hevc_parse: check the size of hvcC is at least 23
> 
> On Tue, Jun 13, 2023 at 3:37 PM Zhao Zhili <quinkblack@foxmail.com> wrote:
> 
> > From: Zhao Zhili <zhilizhao@tencent.com>
> >
> > The code after the check skip 21 bytes and then read two bytes.
> >
> > Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
> > ---
> >  libavcodec/hevc_parse.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/hevc_parse.c b/libavcodec/hevc_parse.c
> > index 1f3beed183..7bc28fd081 100644
> > --- a/libavcodec/hevc_parse.c
> > +++ b/libavcodec/hevc_parse.c
> > @@ -88,8 +88,10 @@ int ff_hevc_decode_extradata(const uint8_t *data, int
> > size, HEVCParamSets *ps,
> >
> >      /* data[0] == 1 is configurationVersion from 14496-15.
> >       * data[0] == 0 is for backward compatibility predates the standard.
> > +     *
> > +     * Minimum number of bytes of hvcC with 0 numOfArrays is 23.
> >       */
> > -    if (size > 3 && ((data[0] == 1) || (data[0] == 0 && (data[1] ||
> > data[2] > 1)))) {
> > +    if (size >= 23 && ((data[0] == 1) || (data[0] == 0 && (data[1] ||
> > data[2] > 1)))) {
> >
> 
> I think it's better to move the size checking before 21 byte are skipped,
> or it'll go to the else logic which
> is different.

It's not avcC if size is less than 23, go to the else branch is the intended behavior.

> 
>          /* It seems the extradata is encoded as hvcC format. */
> >          int i, j, num_arrays, nal_len_size;
> >
> > --
> > 2.25.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".
> >
> _______________________________________________
> 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:[~2023-06-13 17:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20230613073718.675388-1-quinkblack@foxmail.com>
2023-06-13  7:37 ` [FFmpeg-devel] [PATCH 2/4] avcodec/hevc_parse: check the size of hvcC is at least 23 Zhao Zhili
2023-06-13 14:10   ` Lance Wang
2023-06-13 17:11     ` Zhao Zhili
2023-06-13  7:37 ` [FFmpeg-devel] [PATCH 3/4] avformat/asfdec_f: support bmp_tags_unofficial Zhao Zhili
2023-06-13  7:37 ` [FFmpeg-devel] [PATCH 4/4] avformat/asfdec_f: fix need_parsing flag for codec mpeg4 Zhao Zhili

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