[vlc-devel] [PATCH] npapi: zero NPClass before using.

Rafaël Carré funman at videolan.org
Thu Dec 1 04:53:28 CET 2011


Le Thu, 1 Dec 2011 09:13:06 +0700,
Sergey Radionov <rsatom at gmail.com> a écrit :

> From cab0163f1f342909a74cd7d82afd237b14e3e95f Mon Sep 17 00:00:00 2001
> From: Sergey Radionov <RSATom at gmail.com>
> Date: Thu, 1 Dec 2011 09:08:23 +0700
> Subject: [PATCH] npapi: zero NPClass before using.
> 
> fix #3880
> ---
>  npapi/control/nporuntime.h |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/npapi/control/nporuntime.h b/npapi/control/nporuntime.h
> index 799111a..117c584 100644
> --- a/npapi/control/nporuntime.h
> +++ b/npapi/control/nporuntime.h
> @@ -323,6 +323,7 @@ RuntimeNPClass<T>::RuntimeNPClass()
>                  T::methodCount, methodIdentifiers);
>      }
>  
> +    memset(static_cast<NPClass*>(this), 0, sizeof(NPClass));

Why is that needed, doesn't C++ have default constructors?

>      // fill in NPClass structure
>      structVersion  = NP_CLASS_STRUCT_VERSION;
>      allocate       = &RuntimeNPClassAllocate<T>;



-- 
Rafaël Carré



More information about the vlc-devel mailing list