[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[499] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2012-12-02 12:19:12
|
Revision: 499 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=499&view=rev Author: nickols_k Date: 2012-12-02 12:19:04 +0000 (Sun, 02 Dec 2012) Log Message: ----------- new method of antiviral protection Modified Paths: -------------- mplayerxp/input2/input.cpp mplayerxp/libao2/audio_out.cpp mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpdemux/demuxer_stream.cpp mplayerxp/libmpstream/stream.cpp mplayerxp/libvo/video_out.cpp mplayerxp/mplayerxp.cpp mplayerxp/mplayerxp.h mplayerxp/osdep/mplib.cpp mplayerxp/osdep/mplib.h mplayerxp/postproc/af.cpp mplayerxp/postproc/vf.cpp Modified: mplayerxp/input2/input.cpp =================================================================== --- mplayerxp/input2/input.cpp 2012-12-02 11:56:31 UTC (rev 498) +++ mplayerxp/input2/input.cpp 2012-12-02 12:19:04 UTC (rev 499) @@ -749,7 +749,7 @@ filter->ctx = ctx; filter->next = priv->cmd_filters; priv->cmd_filters = filter; - rnd_fill(priv->antiviral_hole,offsetof(priv_t,cmd_binds)-offsetof(priv_t,antiviral_hole)); + fill_false_pointers(priv->antiviral_hole,offsetof(priv_t,cmd_binds)-offsetof(priv_t,antiviral_hole)); } static const char* mp_input_find_bind_for_key(const mp_cmd_bind_t* binds, int n,int* keys) { Modified: mplayerxp/libao2/audio_out.cpp =================================================================== --- mplayerxp/libao2/audio_out.cpp 2012-12-02 11:56:31 UTC (rev 498) +++ mplayerxp/libao2/audio_out.cpp 2012-12-02 12:19:04 UTC (rev 499) @@ -218,8 +218,7 @@ ao->buffersize=-1; ao->opaque=mp_malloc(sizeof(priv_t)); priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); - rnd_fill(priv->antiviral_hole,sizeof(priv_t)); - rnd_fill(ao->antiviral_hole,offsetof(ao_data_t,samplerate)-offsetof(ao_data_t,antiviral_hole)); + fill_false_pointers(ao->antiviral_hole,offsetof(ao_data_t,samplerate)-offsetof(ao_data_t,antiviral_hole)); priv->audio_out=NULL; return ao; } Modified: mplayerxp/libmpdemux/demuxer.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer.cpp 2012-12-02 11:56:31 UTC (rev 498) +++ mplayerxp/libmpdemux/demuxer.cpp 2012-12-02 12:19:04 UTC (rev 499) @@ -108,7 +108,7 @@ demuxer_t* new_demuxer(stream_t *stream,int a_id,int v_id,int s_id){ demuxer_t *d=new(zeromem) demuxer_t; - rnd_fill(d->antiviral_hole,reinterpret_cast<long>(&d->pin)-reinterpret_cast<long>(&d->antiviral_hole)); + fill_false_pointers(d->antiviral_hole,reinterpret_cast<long>(&d->pin)-reinterpret_cast<long>(&d->antiviral_hole)); d->pin=DEMUX_PIN; d->stream=stream; d->movi_start=stream->start_pos; Modified: mplayerxp/libmpdemux/demuxer_stream.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer_stream.cpp 2012-12-02 11:56:31 UTC (rev 498) +++ mplayerxp/libmpdemux/demuxer_stream.cpp 2012-12-02 12:19:04 UTC (rev 499) @@ -15,7 +15,7 @@ Demuxer_Stream::Demuxer_Stream(demuxer_t *_demuxer,int _id) { - rnd_fill(antiviral_hole,reinterpret_cast<long>(&pin)-reinterpret_cast<long>(&antiviral_hole)); + fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&pin)-reinterpret_cast<long>(&antiviral_hole)); pin=DS_PIN; _buffer_pos=_buffer_size=0; _buffer=NULL; Modified: mplayerxp/libmpstream/stream.cpp =================================================================== --- mplayerxp/libmpstream/stream.cpp 2012-12-02 11:56:31 UTC (rev 498) +++ mplayerxp/libmpstream/stream.cpp 2012-12-02 12:19:04 UTC (rev 499) @@ -240,7 +240,7 @@ stream_t *s=new(zeromem) stream_t; if(s==NULL) return NULL; - rnd_fill(s->antiviral_hole,reinterpret_cast<long>(&s->pin)-reinterpret_cast<long>(&s->antiviral_hole)); + fill_false_pointers(s->antiviral_hole,reinterpret_cast<long>(&s->pin)-reinterpret_cast<long>(&s->antiviral_hole)); s->pin=STREAM_PIN; s->fd=-1; s->type=type; Modified: mplayerxp/libvo/video_out.cpp =================================================================== --- mplayerxp/libvo/video_out.cpp 2012-12-02 11:56:31 UTC (rev 498) +++ mplayerxp/libvo/video_out.cpp 2012-12-02 12:19:04 UTC (rev 499) @@ -125,7 +125,7 @@ }; vo_priv_t::vo_priv_t() { - rnd_fill(antiviral_hole,reinterpret_cast<long>(&srcFourcc)-reinterpret_cast<long>(antiviral_hole)); + fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&srcFourcc)-reinterpret_cast<long>(antiviral_hole)); dri.num_xp_frames=1; } @@ -142,7 +142,7 @@ vo_priv_t* priv; priv=new(zeromem) vo_priv_t; vo_priv=priv; - rnd_fill(antiviral_hole,reinterpret_cast<long>(&flags)-reinterpret_cast<long>(&antiviral_hole)); + fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&flags)-reinterpret_cast<long>(&antiviral_hole)); } Video_Output::~Video_Output() { Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-12-02 11:56:31 UTC (rev 498) +++ mplayerxp/mplayerxp.cpp 2012-12-02 12:19:04 UTC (rev 499) @@ -149,7 +149,7 @@ struct MPXPSystem { public: - MPXPSystem():inited_flags(0),osd_function(OSD_PLAY) { rnd_fill(antiviral_hole,reinterpret_cast<long>(&_demuxer)-reinterpret_cast<long>(&antiviral_hole)); } + MPXPSystem():inited_flags(0),osd_function(OSD_PLAY) { fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&_demuxer)-reinterpret_cast<long>(&antiviral_hole)); } virtual ~MPXPSystem() {} void uninit_player(unsigned int mask); Modified: mplayerxp/mplayerxp.h =================================================================== --- mplayerxp/mplayerxp.h 2012-12-02 11:56:31 UTC (rev 498) +++ mplayerxp/mplayerxp.h 2012-12-02 12:19:04 UTC (rev 499) @@ -136,8 +136,8 @@ MPXPContext(); virtual ~MPXPContext(); - audio_processing_t& audio() const { return *_audio; } - video_processing_t& video() const { return *_video; } + virtual audio_processing_t& audio() const { return *_audio; } + virtual video_processing_t& video() const { return *_video; } int rtc_fd; int seek_time; Modified: mplayerxp/osdep/mplib.cpp =================================================================== --- mplayerxp/osdep/mplib.cpp 2012-12-02 11:56:31 UTC (rev 498) +++ mplayerxp/osdep/mplib.cpp 2012-12-02 12:19:04 UTC (rev 499) @@ -26,6 +26,25 @@ return buffer; } +any_t* fill_false_pointers(any_t* buffer,size_t size) +{ + unsigned i,psize=(size/sizeof(any_t*))*sizeof(any_t*); + long lo_mask=(sizeof(any_t*)*8/2)-1; + long hi_mask=~lo_mask; + long filler; + for(i=0;i<psize/sizeof(long);i++) { + filler=rand()&lo_mask; + filler=(reinterpret_cast<long>(buffer)&hi_mask)|lo_mask; + ((long *)buffer)[i]=filler; + } + char ch; + for(i=psize;i<size;i++) { + ch=rand()%255; + ((char *)buffer)[i]=ch; + } + return buffer; +} + any_t* get_caller_address(unsigned num_caller) { any_t* stack[3+num_caller]; backtrace(stack,3+num_caller); Modified: mplayerxp/osdep/mplib.h =================================================================== --- mplayerxp/osdep/mplib.h 2012-12-02 11:56:31 UTC (rev 498) +++ mplayerxp/osdep/mplib.h 2012-12-02 12:19:04 UTC (rev 499) @@ -71,6 +71,7 @@ print_backtrace(why,stack,ncalls); } any_t* __FASTCALL__ rnd_fill(any_t* buffer,size_t size); + any_t* __FASTCALL__ fill_false_pointers(any_t* buffer,size_t size); any_t* get_caller_address(unsigned num_caller=0); template <typename T> class LocalPtr { Modified: mplayerxp/postproc/af.cpp =================================================================== --- mplayerxp/postproc/af.cpp 2012-12-02 11:56:31 UTC (rev 498) +++ mplayerxp/postproc/af.cpp 2012-12-02 12:19:04 UTC (rev 499) @@ -112,7 +112,7 @@ MSG_ERR(MSGTR_OutOfMemory); return NULL; } - rnd_fill(_new->antiviral_hole,offsetof(af_instance_t,pin)-offsetof(af_instance_t,antiviral_hole)); + fill_false_pointers(_new->antiviral_hole,offsetof(af_instance_t,pin)-offsetof(af_instance_t,antiviral_hole)); _new->pin=AF_PIN; _new->parent=s; // Check for commandline parameters @@ -617,7 +617,7 @@ af_stream_t *rval; rval = new(zeromem) af_stream_t; rval->parent = _parent; - rnd_fill(rval->antiviral_hole,offsetof(af_stream_t,first)-offsetof(af_stream_t,antiviral_hole)); + fill_false_pointers(rval->antiviral_hole,offsetof(af_stream_t,first)-offsetof(af_stream_t,antiviral_hole)); return rval; } Modified: mplayerxp/postproc/vf.cpp =================================================================== --- mplayerxp/postproc/vf.cpp 2012-12-02 11:56:31 UTC (rev 498) +++ mplayerxp/postproc/vf.cpp 2012-12-02 12:19:04 UTC (rev 499) @@ -301,7 +301,7 @@ if(!strcmp(filter_list[i]->name,name)) break; } vf=new(zeromem) vf_instance_t; - rnd_fill(vf->antiviral_hole,offsetof(vf_instance_t,pin)-offsetof(vf_instance_t,antiviral_hole)); + fill_false_pointers(vf->antiviral_hole,offsetof(vf_instance_t,pin)-offsetof(vf_instance_t,antiviral_hole)); vf->pin=VF_PIN; vf->info=filter_list[i]; vf->next=next; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |