[FFmpeg-devel] [PATCH v3 1/2] avformat: Add AMQP version 0-9-1 protocol support

Marton Balint cus at passwd.hu
Sun Mar 8 23:04:07 EET 2020



On Sun, 8 Mar 2020, Andriy Gelman wrote:

> From: Andriy Gelman <andriy.gelman at gmail.com>
>
> Supports connecting to a RabbitMQ broker via AMQP version 0-9-1.
>
> Signed-off-by: Andriy Gelman <andriy.gelman at gmail.com>
> ---
>
> Changes in v3:
>    - Fixed a bug when parsing username that contained a url encoded ":"
>    - Fixed documentation error and improved logging
>
> Changes in v2:
>    - Addressed comments from Marton
>    - Updated documentation
>
> Compilation notes:
>    - Requires librabbitmq-dev package (on ubuntu).
>    - The pkg-config libprabbitmq.pc has a corrupt entry.
>      **update: fixed on the github master branch**
>      The line "Libs.private: rt; -lpthread" should be changed to
>      "Libs.private: -lrt -pthread".
>    - Compile FFmpeg with --enable-librabbitmq
>
> Changelog               |   1 +
> configure               |   5 +
> doc/general.texi        |   1 +
> doc/protocols.texi      |  60 ++++++++
> libavformat/Makefile    |   1 +
> libavformat/libamqp.c   | 296 ++++++++++++++++++++++++++++++++++++++++
> libavformat/protocols.c |   1 +
> libavformat/version.h   |   4 +-
> 8 files changed, 367 insertions(+), 2 deletions(-)
> create mode 100644 libavformat/libamqp.c

[...]

> +    password_decoded = ff_urldecode(password, 0);
> +    if (!password_decoded)
> +        return AVERROR(ENOMEM);
> +
> +    user = credentials;
> +    if (*user == '\0')
> +        user = "guest";
> +
> +    user_decoded = ff_urldecode(user, 0);
> +    if (!user_decoded) {
> +        av_freep(&password_decoded);
> +        return AVERROR(ENOMEM);
> +    }
> +
> +    s->conn = amqp_new_connection();
> +    if (!s->conn) {
> +        av_log(h, AV_LOG_ERROR, "Error creating connection\n");
> +        return AVERROR_EXTERNAL;

This is leaking username and password.

Other than that, it looks good. I hope we resolved the usefulness 
concerns, so I plan to apply this tomorrow.

Thanks,
Marton


More information about the ffmpeg-devel mailing list