[FFmpeg-devel] [PATCH] Use av_mallocz in url_open_protocol for URLContext

Daniel Kristjansson danielk
Wed Jan 27 00:32:27 CET 2010

If you register a protocol which uses private data then
av_open_protocol's url_seek() to determine whether the protocol
supports streaming will be called with uninitialized private data.
If say you use the private data in your custom seek bad things
happen. By using av_mallocz the priv_data is initialized to zero
and you can return -1 with the errno set until you can initialize
the priv_data after the av_open_protocol() call (and initialize
is_streamed as well if applicable).

The other way to handle this by creating your own URLContext
without a registered protocol is error prone. As an alternative
to av_mallocz, av_open_protocol() could just initialize priv_data
to NULL as it does other parts of the structure, if that is
preferred I can make a patch for that.

-- Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: avio-mallocz.patch
Type: text/x-patch
Size: 424 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100126/a6d076a2/attachment.bin>

More information about the ffmpeg-devel mailing list