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

Michael Niedermayer michaelni
Wed Jan 27 19:46:29 CET 2010

On Tue, Jan 26, 2010 at 06:32:27PM -0500, Daniel Kristjansson wrote:
> 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

>  avio.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 913b394072395cc6cdb4954e088de2639043d285  avio-mallocz.patch


Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes
-------------- 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/20100127/e97c17e0/attachment.pgp>

More information about the ffmpeg-devel mailing list