[FFmpeg-devel] [PATCH] Adds support parsing the QuickTime Metadata Keys.

Derek Buitenhuis derek.buitenhuis at gmail.com
Fri Oct 23 01:10:20 CEST 2015

On 10/22/2015 11:04 PM, Tinglin Liu wrote:
> +        } else if (data_type == 23 && str_size >= 4) {  // BE float32
> +            union av_intfloat32 val;
> +            val.i = avio_rb32(pb);

I found we have a function to to this: av_int2float().

> +            if (snprintf(str, str_size_alloc, "%f", val.f) >= str_size_alloc) {

snprintf can never return a value greater than the length passed to it, so just == is fine.

Although, thinking about it, I was incorrect in thinking it could overflow the 512+1 length
buffer, since the largest float with precision of 6 (the default in C) + radix is smaller
than that by a lot. My bad.

Nothing here warrants resending, IMO, and I will amend and push tomorrow, to allow time
for others to review or comment in the meantime.

- Derek

More information about the ffmpeg-devel mailing list