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

Stefano Sabatini stefano.sabatini-lala
Mon Jan 12 21:56:33 CET 2009


On date Tuesday 2009-01-06 23:01:27 +0100, Stefano Sabatini encoded:
> 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.

Ping?
-- 
FFmpeg = Frightening & Freak Marvellous Powerful Erotic Gargoyle




More information about the ffmpeg-devel mailing list