ffmpeg | branch: master | Marton Balint <c...@passwd.hu> | Sun May 5 21:31:47 2024 +0200| [8d92f59d117a19e910574c0fe3c67e71dfe11b72] | committer: Marton Balint
avformat/file: fail for non-numerical arguments to pipe: Before this patch, the implementation of pipe: inputs/outputs would silently fall back to stdin/stdout for any argument not successfully parsed by strtol(). This patch introduces an explicit error for any non-numerical arguments, which should avoid user confusion as in #10977. New behavior: $ cat /tmp/video.mkv | ./ffmpeg -i pipe:aa -acodec copy -vcodec copy -f matroska pipe:1 | cat >/tmp/out.mkv [pipe @ 0x5618c7bcf740] Non-numerical argument "aa" to pipe: [in#0 @ 0x5618c7bced00] Error opening input: Invalid argument Error opening input file pipe:aa. Error opening input files: Invalid argument Based on the patch of Nils Goroll <nils.gor...@uplex.de>. Signed-off-by: Marton Balint <c...@passwd.hu> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8d92f59d117a19e910574c0fe3c67e71dfe11b72 --- libavformat/file.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavformat/file.c b/libavformat/file.c index 0b7452bc20..0ed4cff266 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -442,13 +442,16 @@ static int pipe_open(URLContext *h, const char *filename, int flags) if (c->fd < 0) { av_strstart(filename, "pipe:", &filename); - fd = strtol(filename, &final, 10); - if((filename == final) || *final ) {/* No digits found, or something like 10ab */ + if (!*filename) { if (flags & AVIO_FLAG_WRITE) { fd = 1; } else { fd = 0; } + } else { + fd = strtol(filename, &final, 10); + if (*final) /* No digits found, or something like 10ab */ + return AVERROR(EINVAL); } c->fd = fd; } _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".