[MPlayer-dev-eng] [PATCH] Subtitles directories

Clément Bœsch ubitux at gmail.com
Sun Nov 21 17:46:16 CET 2010


On Sun, Nov 21, 2010 at 12:24:32PM +0100, Reimar Döffinger wrote:
> On Sun, Nov 21, 2010 at 12:05:58PM +0100, Clément Bœsch wrote:
> > +static void append_sub(struct sub_list *dst, struct subfn *src)
> 
> I suspect you are lucky here and a check outside that function saves you.
> However
> 
> > +    dst->size = dst->sid + src->sid;
> 
> Possibly integer overflow.
> 
> > +    dst->subs = realloc(dst->subs, sizeof(*dst->subs) * dst->size);
> 
> Possible integer overflow.
> Also realloc failure is not handled.
> 
> > +        struct sub_list tmp_list = get_sub_list(mp_subdir, fname);
> > +        merge_subs(&fslist, &tmp_list);
> 
> You always call first get_sub_list and then merge_subs,
> why not just append them to the proper list in the
> first place in get_sub_list?
> Also I'd be strongly in favour of limiting the number of
> overall subs, not just per directory, then you can just
> avoid all that realloc and overflow checking mess and
> allocate a array with max size from the start.

OK, I removed all the realloc stuff, so it simplifies things a bit. Is
it easier to review?

-- 
Clément B.
Not sent from a jesusPhone.


More information about the MPlayer-dev-eng mailing list