changeset 26532:4dae224112a1 stable

ov-java.cc: Fix static analyzer detected issue (bug #55464). * ov-java.cc (initialize_jvm): Check validity of pointer "static_locale" before using.
author Markus Mützel <markus.muetzel@gmx.de>
date Sun, 13 Jan 2019 14:34:31 +0100
parents 481ac37b0e0e
children 8c3e727c44b5 c8efbaf65180
files libinterp/octave-value/ov-java.cc
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-java.cc	Sun Jan 13 14:31:16 2019 +0100
+++ b/libinterp/octave-value/ov-java.cc	Sun Jan 13 14:34:31 2019 +0100
@@ -629,7 +629,9 @@
 
   JNIEnv *current_env;
   const char *static_locale = setlocale (LC_ALL, nullptr);
-  const std::string locale (static_locale);
+  std::string locale;
+  if (static_locale)
+    locale = std::string (static_locale);
 
   octave::dynamic_library lib ("");
   std::string jvm_lib_path = "linked in or loaded libraries";