[FFmpeg-devel] [PATCH] [RFC] avformat: Add basic same origin check

Anton Khirnov anton at khirnov.net
Wed May 3 12:23:20 EEST 2023


Quoting Michael Niedermayer (2023-05-02 21:36:31)
> TODO: bump minor version, add docs
> 
> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> ---
>  libavformat/avformat.h      | 10 ++++++++++
>  libavformat/options.c       | 29 +++++++++++++++++++++++++++++
>  libavformat/options_table.h |  3 +++
>  3 files changed, 42 insertions(+)
> 
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index 1916aa2dc5..5ff77323ba 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -1713,6 +1713,16 @@ typedef struct AVFormatContext {
>       * @return 0 on success, a negative AVERROR code on failure
>       */
>      int (*io_close2)(struct AVFormatContext *s, AVIOContext *pb);
> +
> +    /**
> +     * Perform basic same origin checks in default io_open()
> +     * - encoding: set by user
> +     * - decoding: set by user
> +     */
> +    int same_origin_check;
> +#define AVFMT_SAME_ORIGIN_CHECK_NONE 0  //no check
> +#define AVFMT_SAME_ORIGIN_CHECK_HOST 1  //protocol, host, auth, port
> +#define AVFMT_SAME_ORIGIN_CHECK_PATH 2  //protocol, host, auth, port, parent path

Shouldn't these be flags instead?

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list