/hg/release/icedtea-web-1.6: Fixed possible segfault during file...

Jacob Wisor gitne at gmx.de
Fri Oct 2 14:05:35 UTC 2015


On 10/02/2015 at 03:35 PM jvanek at icedtea.classpath.org wrote:
> changeset cbc3174bed98 in /hg/release/icedtea-web-1.6
> details: http://icedtea.classpath.org/hg/release/icedtea-web-1.6?cmd=changeset;node=cbc3174bed98
> author: Jiri Vanek <jvanek at redhat.com>
> date: Fri Oct 02 15:35:30 2015 +0200
>
> 	Fixed possible segfault during files on and debug on
>
>
> diffstat:
>
>   ChangeLog                             |  10 ++++++++++
>   plugin/icedteanp/IcedTeaNPPlugin.cc   |   3 ++-
>   plugin/icedteanp/IcedTeaNPPlugin.h    |   1 +
>   plugin/icedteanp/IcedTeaPluginUtils.h |   5 +++--
>   4 files changed, 16 insertions(+), 3 deletions(-)
>
> diffs (76 lines):
>
> diff -r 75504136acda -r cbc3174bed98 ChangeLog
> --- a/ChangeLog	Tue Sep 22 18:24:33 2015 +0200
> +++ b/ChangeLog	Fri Oct 02 15:35:30 2015 +0200
> @@ -1,3 +1,13 @@
> +2015-10-02  Jiri Vanek  <jvanek at redhat.com>
> +
> +	Fixed possible segfault during files on and debug on
> +	* plugin/icedteanp/IcedTeaNPPlugin.cc: added file_logs_initiated initiated as
> +	false. plugin_file_log initiated to NULL.
> +	* plugin/icedteanp/IcedTeaNPPlugin.h: made aware about extern file_logs_initiated
> +	* plugin/icedteanp/IcedTeaPluginUtils.h: (initialize_debug) set file_logs_initiated
> +	to true after initFileLog finishes. (PLUGIN_DEBUG) and (PLUGIN_ERROR) logs to
> +	file only when enabled and initiated.
> +
>   2015-09-22  Jiri Vanek  <jvanek at redhat.com>
>
>   	fixed two doclint errors
> diff -r 75504136acda -r cbc3174bed98 plugin/icedteanp/IcedTeaNPPlugin.cc
> --- a/plugin/icedteanp/IcedTeaNPPlugin.cc	Tue Sep 22 18:24:33 2015 +0200
> +++ b/plugin/icedteanp/IcedTeaNPPlugin.cc	Fri Oct 02 15:35:30 2015 +0200
> @@ -241,13 +241,14 @@
>   static guint appletviewer_watch_id = -1;
>
>   bool debug_initiated = false;
> +bool file_logs_initiated = false;

This exactly what I meant. There is no need for this. It does not add any logic 
nor is it correct. This makes me assume that you either did not read my post 
carefully enough or did not understand it. Please remove this, as this does not 
add any program logic and is based on wrong assumptions.

>   int plugin_debug = getenv ("ICEDTEAPLUGIN_DEBUG") != NULL;
>   bool plugin_debug_headers = false;
>   bool plugin_debug_to_file = false ;
>   bool plugin_debug_to_streams = true ;
>   bool plugin_debug_to_system = false;
>   bool plugin_debug_to_console = true;
> -FILE *  plugin_file_log;
> +FILE *  plugin_file_log = NULL;
>   std::string plugin_file_log_name;
>
>   int plugin_debug_suspend = (getenv("ICEDTEAPLUGIN_DEBUG") != NULL) &&
> diff -r 75504136acda -r cbc3174bed98 plugin/icedteanp/IcedTeaNPPlugin.h
> --- a/plugin/icedteanp/IcedTeaNPPlugin.h	Tue Sep 22 18:24:33 2015 +0200
> +++ b/plugin/icedteanp/IcedTeaNPPlugin.h	Fri Oct 02 15:35:30 2015 +0200
> @@ -117,6 +117,7 @@
>
>   // debug switches
>   extern bool debug_initiated;
> +extern bool file_logs_initiated;
>   extern int plugin_debug;
>   extern bool plugin_debug_headers;
>   extern bool plugin_debug_to_file;
> diff -r 75504136acda -r cbc3174bed98 plugin/icedteanp/IcedTeaPluginUtils.h
> --- a/plugin/icedteanp/IcedTeaPluginUtils.h	Tue Sep 22 18:24:33 2015 +0200
> +++ b/plugin/icedteanp/IcedTeaPluginUtils.h	Fri Oct 02 15:35:30 2015 +0200
> @@ -86,6 +86,7 @@
>         plugin_debug_to_console = is_java_console_enabled();                    \
>         if (plugin_debug_to_file) {                                             \
>              IcedTeaPluginUtilities::initFileLog();                             \
> +           file_logs_initiated = true;                                        \

Again, you cannot assume that after IcedTeaPluginUtilities::initFileLog() has 
been called, the log file has been properly initialized.

>         }                                                                       \
>         if (plugin_debug_to_console) {                                          \
>             /*initialisation done during jvm startup*/                          \
> @@ -134,7 +135,7 @@
>           snprintf(ldebug_message, MESSAGE_SIZE, "%s%s", ldebug_header, ldebug_body); \
>           fprintf  (stdout, "%s", ldebug_message);\
>         }                                \
> -      if (plugin_debug_to_file) {      \
> +      if (plugin_debug_to_file && file_logs_initiated) {      \
>           snprintf(ldebug_message, MESSAGE_SIZE, "%s%s", ldebug_header, ldebug_body);   \
>           fprintf (plugin_file_log, "%s", ldebug_message);   \
>           fflush(plugin_file_log);       \
> @@ -180,7 +181,7 @@
>         snprintf(ldebug_message, MESSAGE_SIZE, "%s%s", ldebug_header, ldebug_body); \
>         fprintf  (stderr, "%s", ldebug_message);                                    \
>       }                                  \
> -    if (plugin_debug_to_file) {        \
> +    if (plugin_debug_to_file && file_logs_initiated) {        \
>         snprintf(ldebug_message, MESSAGE_SIZE, "%s%s", ldebug_header, ldebug_body); \
>         fprintf (plugin_file_log, "%s", ldebug_message);   \
>         fflush(plugin_file_log);         \
>


More information about the distro-pkg-dev mailing list