[vlc-devel] [PATCH 1/4] Fix check for plugin table size
Rafaël Carré
funman at videolan.org
Mon Dec 31 00:26:09 CET 2012
Le 31/12/2012 00:12, Cheng Sun a écrit :
> On 30/12/12 22:59, Rafaël Carré wrote:
>> Le 30/12/2012 21:51, Cheng Sun a écrit :
>>> ---
>>> npapi/support/npunix.cpp | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/npapi/support/npunix.cpp b/npapi/support/npunix.cpp
>>> index 0f4baaf..1f3f778 100644
>>> --- a/npapi/support/npunix.cpp
>>> +++ b/npapi/support/npunix.cpp
>>> @@ -847,7 +847,7 @@ NP_Initialize(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs)
>>> err = NPERR_INCOMPATIBLE_VERSION_ERROR;
>>> if (nsTable->size < ((char *)&nsTable->posturlnotify - (char *)nsTable))
>>> err = NPERR_INVALID_FUNCTABLE_ERROR;
>>> - if (pluginFuncs->size < sizeof(NPPluginFuncs))
>>> + if (pluginFuncs->size < (char *)&pluginFuncs->setvalue - (char *)pluginFuncs)
>>> err = NPERR_INVALID_FUNCTABLE_ERROR;
>>> }
>>
>> What does it fix exactly?
>
> The NPAPI library version that we've been compiled with might be *more
> recent* than the NPAPI header version of the browser. Which means that
> the pluginFuncs table that we have has more entries in it than the
> browser is expecting. However, NPAPI was designed with
> backwards-compatibility in mind, and when the plugin table is revised by
> Mozilla, new entries are added to the end of the table.
>
> Before we were asserting that the plugin table that the browser gives us
> to fill in is big enough for the entire table that we've been compiled
> with, but now we check whether the table is just big enough for the
> entries that we actually use.
Thanks,
I think this paragraph definitely has its place in the commit log, don't
be afraid to be too verbose!
(I will let NPAPI experts handle this change though)
More information about the vlc-devel
mailing list