[FFmpeg-devel] [PATCH] ffprobe: implement string validation policy setting

Stefano Sabatini stefasab at gmail.com
Wed Oct 2 18:49:28 CEST 2013


On date Wednesday 2013-10-02 17:52:05 +0200, Stefano Sabatini encoded:
> This should fix trac tickets #1163, #2502, #2955.
> ---
>  doc/ffprobe.texi |  24 ++++++++++
>  ffprobe.c        | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
>  2 files changed, 158 insertions(+), 7 deletions(-)

[...]
> +static inline int validate_string(char **dstp, const char *src, void *log_ctx)
> +{
> +    const uint8_t *p;
> +    AVBPrint dstbuf;
> +    int invalid_chars_nb = 0, ret = 0;
> +
> +    av_bprint_init(&dstbuf, 0, AV_BPRINT_SIZE_UNLIMITED);
> +
> +    for (p = src; *p;) {
> +        uint32_t code;
> +        uint8_t tmp;
> +        int invalid = 0;
> +
> +        GET_UTF8(code, *p++, invalid = 1;);

> +        if (invalid) {
> +            invalid_chars_nb++;

This is not enough with metadata-with-control-characters.avi from
ticket #2955, containing the ASCII character #18 (CANC). If I add:

        if (code < 128 && !av_isgraph(code))
            invalid = 1;

it works.

[...]
-- 
FFmpeg = Forgiving and Forgiving Magnificient Perennial Ephemeral God


More information about the ffmpeg-devel mailing list