[FFmpeg-devel] [PATCH] urlconcat protocol

Michael Niedermayer michaelni
Fri Feb 5 12:01:29 CET 2010


On Fri, Feb 05, 2010 at 08:07:50AM +0100, Michele Orr? wrote:
> >
> > trailing whitespace is forbidden in our svn
> > maybe you want to try our patcheck script (see tools directory in svn)
> >
> ok, done,
> 
> 
> > > +    if (err < 0)
> > > +        urlconcat_close(h);
> > > +    else
> > > +        unodes = av_realloc(unodes, udata->length * sizeof(*unodes));
> > > +    return err;
> >
> > the new array isnt stored anywhere and the failure cases is not handled
> >
> > Nope.
>  At line 75 we make an an an array enough long to contain all urls , but
> using as size as many times AV_CAT_SEPARATOR is present on *uri (+1).
>  At line 100, instead, we move to the next url (uri += len + strspn()). So,
> strings like cat:foo||bar are accepted.
> 
>  In the end, we realloc *nodes in order to free all the useless space that
> could be allocated due to multiple consecutive AV_CAT_SEPARATOR. But, it's
> obviuos that this new size is less than the original size. So, why manage
> the case of failure?

Nothing gurantees that a realloc() reducing the size of an array succeed
And id be surprised if there is no place where realloc() is implemented as
a malloc();memcpy();free(); which certainly can fail

also the smaller unodes may be at a different place in memory

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 1
"Used only once"    - "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100205/19fef777/attachment.pgp>



More information about the ffmpeg-devel mailing list