[FFmpeg-devel] [PATCH v1] fftools/ffplay: Resolve input file path before processing
Appaji
appaji12368 at gmail.com
Tue May 13 23:58:35 EEST 2025
Fixes ticket: https://trac.ffmpeg.org/ticket/11574
Signed-off-by: Appaji <appaji12368 at gmail.com>
---
fftools/ffplay.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 2a572fc3aa..42f0584b55 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -27,6 +27,7 @@
#include "config_components.h"
#include <math.h>
#include <limits.h>
+#include <stdlib.h>
#include <signal.h>
#include <stdint.h>
@@ -3623,9 +3624,17 @@ static int opt_input_file(void *optctx, const char *filename)
filename, input_filename);
return AVERROR(EINVAL);
}
- if (!strcmp(filename, "-"))
+
+ char resolved_path[PATH_MAX];
+
+ if (!realpath(filename, resolved_path)) {
+ av_log(NULL, AV_LOG_FATAL, "Failed to resolve path for '%s': %s\n", filename, strerror(errno));
+ return AVERROR(errno);
+ }
+
+ if (!strcmp(resolved_path, "-"))
filename = "fd:";
- input_filename = av_strdup(filename);
+ input_filename = av_strdup(resolved_path);
if (!input_filename)
return AVERROR(ENOMEM);
--
2.43.0
More information about the ffmpeg-devel
mailing list