octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #53733] Panic/segfault when calling Java metho


From: Rik
Subject: [Octave-bug-tracker] [bug #53733] Panic/segfault when calling Java method after forge:im[read|write]
Date: Tue, 24 Apr 2018 16:12:26 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Follow-up Comment #10, bug #53733 (project octave):

Stepping through the code in initialize_jvm


  JNIEnv *current_env;
  const char *static_locale = setlocale (LC_ALL, nullptr);
  const std::string locale (static_locale);

  octave::dynamic_library lib ("");
  std::string jvm_lib_path = "linked in or loaded libraries";

  // Check whether the Java VM library is already loaded or linked in.
  JNI_CreateJavaVM_t create_vm = reinterpret_cast<JNI_CreateJavaVM_t>
                                 (lib.search ("JNI_CreateJavaVM"));
  JNI_GetCreatedJavaVMs_t get_vm = reinterpret_cast<JNI_GetCreatedJavaVMs_t>
                                   (lib.search ("JNI_GetCreatedJavaVMs"));

  if (! create_vm || ! get_vm)
    {


I checked and both create_vm and get_vm are 0 so this branch is taken.

The code then jumps down to this


#else
      // JAVA_LDPATH determined by configure and set in config.h
#  if defined (__APPLE__)
      jvm_lib_path = JAVA_LDPATH + std::string ("/libjvm.dylib");
#  else
      jvm_lib_path = JAVA_LDPATH + std::string ("/libjvm.so");
#  endif
#endif
      lib = octave::dynamic_library (jvm_lib_path);


For a Linux system, the path ends in libjvm.so.  Finally, the segfault occurs
in the next line.

Maybe something bad happens when we call the constructor with a null value?


  octave::dynamic_library lib ("");


Or maybe when lib.search fails it leaves the object lib in a bad state?



    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?53733>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]