Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Zhao Zhili <quinkblack-at-foxmail.com@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Zhao Zhili <zhilizhao@tencent.com>
Subject: [FFmpeg-devel] [PATCH v2 7/8] avformat/flvdec: Fix error handling of parse_video_color_info
Date: Tue, 11 Mar 2025 10:49:41 +0800
Message-ID: <tencent_2BCBA66619108C66DCA7C0AAAD13109C5B06@qq.com> (raw)

From: Zhao Zhili <zhilizhao@tencent.com>

Some error should not be ignored.
---
 libavformat/flvdec.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index b4d2d7e2b8..b431dabffc 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -1194,13 +1194,18 @@ static int flv_parse_video_color_info(AVFormatContext *s, AVStream *st, int64_t
 
     // first object needs to be "colorInfo" string
     type = avio_r8(ioc);
-    if (type != AMF_DATA_TYPE_STRING ||
-        amf_get_string(ioc, buffer, sizeof(buffer)) < 0)
-        return TYPE_UNKNOWN;
+    if (type != AMF_DATA_TYPE_STRING) {
+        av_log(s, AV_LOG_WARNING, "Ignore invalid colorInfo\n");
+        return 0;
+    }
 
-    if (strcmp(buffer, "colorInfo")) {
-        av_log(s, AV_LOG_DEBUG, "Unknown type %s\n", buffer);
-        return TYPE_UNKNOWN;
+    ret = amf_get_string(ioc, buffer, sizeof(buffer));
+    if (ret < 0)
+        return ret;
+
+    if (strcmp(buffer, "colorInfo") != 0) {
+        av_log(s, AV_LOG_WARNING, "Ignore invalid colorInfo type %s\n", buffer);
+        return 0;
     }
 
     flv->meta_color_info_flag = FLV_COLOR_INFO_FLAG_PARSING;
@@ -1481,8 +1486,9 @@ retry:
 
         if (enhanced_flv && (flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_VIDEO_INFO_CMD) {
             if (pkt_type == PacketTypeMetadata) {
-                int sret = flv_parse_video_color_info(s, st, next);
-                av_log(s, AV_LOG_DEBUG, "enhanced flv parse metadata ret %d and skip\n", sret);
+                ret = flv_parse_video_color_info(s, st, next);
+                if (ret < 0)
+                    goto leave;
             }
             goto skip;
         } else if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_VIDEO_INFO_CMD) {
-- 
2.46.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".

                 reply	other threads:[~2025-03-11  2:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_2BCBA66619108C66DCA7C0AAAD13109C5B06@qq.com \
    --to=quinkblack-at-foxmail.com@ffmpeg.org \
    --cc=ffmpeg-devel@ffmpeg.org \
    --cc=zhilizhao@tencent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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