[FFmpeg-devel] [PATCH 02/11] lavf: add internal demuxer helpers for subtitles.

Stefano Sabatini stefasab at gmail.com
Mon Jun 25 14:36:54 CEST 2012


On date Saturday 2012-06-23 21:34:26 +0200, Clément Bœsch encoded:
> On Sat, Jun 23, 2012 at 12:30 AM, Stefano Sabatini <stefasab at gmail.com> wrote:
> > On date Friday 2012-06-22 22:43:57 +0200, Clément Bœsch encoded:
> >> ---
> >>  libavformat/Makefile    |   1 +
> >>  libavformat/subtitles.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++++
> >>  libavformat/subtitles.h |  61 +++++++++++++++++++++++++++++
> >>  3 files changed, 163 insertions(+)
> >>  create mode 100644 libavformat/subtitles.c
> >>  create mode 100644 libavformat/subtitles.h
> >>
[...]
> >> +int ff_subtitles_queue_read_packet(FFDemuxSubtitlesQueue *q, AVPacket *pkt)
> >> +{
> >> +    AVPacket *sub = q->subs + q->current_sub;
> >> +
> >
> >> +    if (q->current_sub == q->nsub)
> >> +        return AVERROR_EOF;
> >
> > I'd consider safer to set q to NULL in that case, rather than point to
> > foo data.
> >
>
> I don't understand what you mean; if you mean making current_sub
> pointing on something valid, I can't even set it to 0 (since there
> might not be any subtitles at all. Also, I don't want to automatically
> destroy q since we may want to seek after that.

Sorry I meant *pkt = NULL, in order to avoid to pass a random address
from the heap (while the likeliness of an exploit is low in this case,
it is still good to tell the user that she got no valid data). That
said, and since the API is private feel free to ignore this point.

[other nits fixed]

Thanks.
-- 
FFmpeg = Faithless Fanciful Magnificient Philosophical EnGraver


More information about the ffmpeg-devel mailing list