[FFmpeg-devel] [PATCH] lavf/id3v2: fail read_apic on EOF reading mimetype

Chris Cunningham chcunningham at chromium.org
Thu Dec 13 21:18:47 EET 2018

> Yet another problem that could have been caught by static analysis..
> Wouldn't it be better to always leave the array in a valid state?

Will add that in the next patch. It has the extra benefit of protecting the
isv34 branch.

Goto fail; skips a lot of lines that aren't needed if mimetype is empty, so
I think its worth keeping as well. I'd love to do similar for the isv34
branch, but I'm not sure how to detect the condition given the EOF behavior
for  avio_get_str:

 * @return number of bytes read (is always <= maxlen).
 * If reading ends on EOF or error, the return value will be one more than
 * bytes actually read.

How do callers differentiate between cases where you read 5 bytes vs
reading just 4 bytes and hitting an error - IIIUC both cases return 5.

More information about the ffmpeg-devel mailing list