Hi,

On Thu, Sep 1, 2011 at 11:20 PM, David Goldwich
<[email protected]> wrote:
> +    /* read encoding type byte */
> +    encoding = avio_r8(pb);
> +    taglen--;
> +    switch (encoding) {
> +        case ID3v2_ENCODING_ISO8859:
> +        case ID3v2_ENCODING_UTF8:
> +            get_str = avio_get_str;
> +            break;
> +        case ID3v2_ENCODING_UTF16BE:
> +        case ID3v2_ENCODING_UTF16BOM:
> +            get_str = avio_get_str16be;
> +            break;
> +        default:
> +            av_log(s, AV_LOG_ERROR, "Unknown encoding in GEOB tag.\n");
> +            return;
> +    }

This appears duplicated in various places in this file now, maybe generalize.

> +    /* peek forward to figure out the length of the content part and decode 
> it */
> +#define PEEK_DECODE(get, key, encoding) \
> +    pos = avio_tell(pb);\
> +    len = get(pb, taglen, buf, sizeof(buf));\
> +    geob_data->key = av_mallocz(len + 7);\
> +    if (!geob_data->key) {\
> +        av_log(s, AV_LOG_ERROR, "Failed to alloc %d bytes\n", len + 7);\
> +        return;\
> +    }\
> +    avio_seek(pb, pos, SEEK_SET);\
> +    decode_content(s, pb, encoding, geob_data->key, len + 7, len, "GEOB");\
> +    taglen -= len;\

This is admittedly ugly and fails with streaming content, can you
somehow do this by reallocating the buffer somehow if the orig alloc
isn't big enough? Is there a typical length for these tags?

Also doesn't check against overflows for the +7.

Ronald
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to