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] lavu: make av_get_media_type_string() never return NULL
@ 2022-02-01 22:30 Scott Theisen
  2022-02-01 22:34 ` James Almer
                   ` (4 more replies)
  0 siblings, 5 replies; 19+ messages in thread
From: Scott Theisen @ 2022-02-01 22:30 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Scott Theisen

printf %s with a null pointer is undefined behavior
---
 libavutil/avutil.h | 3 +--
 libavutil/utils.c  | 3 ++-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index 4d633156d1..4bd468d72f 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -207,8 +207,7 @@ enum AVMediaType {
 };
 
 /**
- * Return a string describing the media_type enum, NULL if media_type
- * is unknown.
+ * Return a string describing the media_type enum, never NULL.
  */
 const char *av_get_media_type_string(enum AVMediaType media_type);
 
diff --git a/libavutil/utils.c b/libavutil/utils.c
index ea9b5097b8..c85d7abace 100644
--- a/libavutil/utils.c
+++ b/libavutil/utils.c
@@ -71,12 +71,13 @@ const char *avutil_license(void)
 const char *av_get_media_type_string(enum AVMediaType media_type)
 {
     switch (media_type) {
+    case AVMEDIA_TYPE_UNKNOWN:    return "unknown";
     case AVMEDIA_TYPE_VIDEO:      return "video";
     case AVMEDIA_TYPE_AUDIO:      return "audio";
     case AVMEDIA_TYPE_DATA:       return "data";
     case AVMEDIA_TYPE_SUBTITLE:   return "subtitle";
     case AVMEDIA_TYPE_ATTACHMENT: return "attachment";
-    default:                      return NULL;
+    default:                      return "invalid";
     }
 }
 
-- 
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] 19+ messages in thread

end of thread, other threads:[~2022-09-16 17:33 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-01 22:30 [FFmpeg-devel] [PATCH] lavu: make av_get_media_type_string() never return NULL Scott Theisen
2022-02-01 22:34 ` James Almer
2022-02-02  1:58   ` Scott Theisen
2022-02-02  2:06     ` James Almer
2022-02-02  2:42       ` Scott Theisen
2022-02-02  2:13     ` Andreas Rheinhardt
2022-02-23  7:52     ` Anton Khirnov
2022-02-28 21:06       ` Scott Theisen
2022-02-03 20:09 ` [FFmpeg-devel] [PATCH v2] create av_media_type_get_string() Scott Theisen
2022-02-03 20:09   ` [FFmpeg-devel] [PATCH 1/2] libavutil: " Scott Theisen
2022-02-03 20:09   ` [FFmpeg-devel] [PATCH 2/2] replace av_get_media_type_string() with av_media_type_get_string() Scott Theisen
2022-02-13 21:52 ` [FFmpeg-devel] [PATCH v3] create av_media_type_get_string() Scott Theisen
2022-02-13 21:52   ` [FFmpeg-devel] [PATCH v3 1/2] libavutil: " Scott Theisen
2022-02-13 21:52   ` [FFmpeg-devel] [PATCH v3 2/2] av_get_media_type_string(): replace with av_media_type_get_string() Scott Theisen
2022-05-15 19:55 ` [FFmpeg-devel] [Patch v4 0/2] create av_media_type_get_string() Scott Theisen
2022-05-15 19:55   ` [FFmpeg-devel] [PATCH v4 1/2] libavutil: " Scott Theisen
2022-05-15 19:55   ` [FFmpeg-devel] [PATCH v4 2/2] av_get_media_type_string(): replace with av_media_type_get_string() Scott Theisen
2022-06-01 19:22 ` [FFmpeg-devel] [PATCH] " Scott Theisen
2022-09-16 17:32   ` [FFmpeg-devel] [PATCH v2] " Scott Theisen

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