[rfc][icedtea-web] (C++) More precise check of browser table and plugin table callback structures in NP_Initialize
Pavel Tisnovsky
ptisnovs at redhat.com
Thu Jun 21 06:39:49 PDT 2012
Hi Adam,
at first I was a bit scared because the pointer arithmetic used to
calculate table sizes, but your code is AFAIK correct.
I have just one minor note - I think it would me more informative
for a user/tester/developer to divide following condition into
two conditions, because the message "Browser or plugin function table is NULL."
is (AFAIK) too vague and it could means three distinct states:
+ if ((browserTable == NULL) || (pluginTable == NULL))
+ {
+ PLUGIN_ERROR ("Browser or plugin function table is NULL.");
+
+ return NPERR_INVALID_FUNCTABLE_ERROR;
+ }
Other code is ok.
Cheers,
Pavel
Adam Domurad wrote:
> Hey all. This is motivated by the recent version of Google Chrome
> erroring and not running the plugin, giving 'Invalid plugin table.' I
> was speaking with Deepak on ways to solve this issue and came up with
> this solution.
>
> The previous code checked the size of NPPluginFunc's (as well as
> NPNetscapeFunc's) against the size reported by the browser. This code
> merely requires the browser to pass a copy of these structures big
> enough to support the functions we actually use.
>
> The previous code could in theory write past the end of an object as
> well, as it only warned if NPPluginFunc was not big enough.
>
> The code now always errors if functionality we need is not provided.
>
> Changelog:
> 2012-06-18 Adam Domurad <adomurad at redhat.com>
>
> Allow passing of plugin tables and browser tables in NP_Initialize that
> are not the expected length but still large enough for our purposes.
> * plugin/icedteanp/IcedTeaNPPlugin.cc
> (initialize_browser_functions): New function to check size of passed
> browser function table, and initialize 'browser_functions' global
> variable.
> (initialize_plugin_table): New function to check size of passed
> plugin function table, and initialize proper plugin callbacks.
> (NP_Initialize): Make use of initialization helper functions, get
> rid of old size tests and error if the helper functions fail.
>
More information about the distro-pkg-dev
mailing list