[FFmpeg-devel] [PATCH] change the order of params for av_init_random()

Stefano Sabatini stefano.sabatini-lala
Tue Jan 6 23:01:27 CET 2009


On date Monday 2009-01-05 17:00:50 +0100, Michael Niedermayer encoded:
> On Mon, Jan 05, 2009 at 02:44:34AM +0100, Stefano Sabatini wrote:
> [...]
> > Index: ffmpeg/ffserver.c
> > ===================================================================
> > --- ffmpeg.orig/ffserver.c	2009-01-05 02:40:48.000000000 +0100
> > +++ ffmpeg/ffserver.c	2009-01-05 02:41:00.000000000 +0100
> > @@ -4483,7 +4483,7 @@
> >  
> >      unsetenv("http_proxy");             /* Kill the http_proxy */
> >  
> > -    av_init_random(av_gettime() + (getpid() << 16), &random_state);
> > +    av_random_init(&random_state, av_gettime() + (getpid() << 16));
> >  
> >      memset(&sigact, 0, sizeof(sigact));
> >      sigact.sa_handler = handle_child_exit;
> 
> do we really have to export the pid and starttime to an attacker?

Apart from this, is the patchset OK?

Just a note regarding the first patch
"change-ffserver-include-order.patch".

This is required since in order to deprecate av_init_random() I need
to include libavutil/common.h in random.h, which defines
attribute_deprecated but also other macros which are defined
conditionally with respect to LIBAVFORMAT_BUILD:

Check in libavutil/internal.h:

#ifndef LIBAVFORMAT_BUILD
#undef  printf
#define printf please_use_av_log
#undef  fprintf
#define fprintf please_use_av_log
#undef  puts
#define puts please_use_av_log
#undef  perror
#define perror please_use_av_log_instead_of_perror
#endif
 
If libavutil/random.h is defined before libavutil/avformat.h,
LIBAVFORMAT_BUILD is undefined when that is included and those macros
will be defined, resulting in a linking error, since ffserver uses
printf and friends.

Making ffserver include avformat.h before the other headers files
ensures that the LIBAVFORMAT_BUILD symbol is defined before to
include the other files.

Regards.
-- 
FFmpeg = Fast and Foolish Mastering Pitiful Enlightening Geek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: change-ffserver-include-order.patch
Type: text/x-diff
Size: 801 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090106/8c66a44b/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: implement-av-random-init.patch
Type: text/x-diff
Size: 2579 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090106/8c66a44b/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: replace-av-init-random-use.patch
Type: text/x-diff
Size: 4550 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090106/8c66a44b/attachment-0002.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ifver-av-init-random.patch
Type: text/x-diff
Size: 1448 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090106/8c66a44b/attachment-0003.patch>



More information about the ffmpeg-devel mailing list