help-octave
[Top][All Lists]
Advanced

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

bug in exist() when checking for a faulty mex/oct file


From: krthie
Subject: bug in exist() when checking for a faulty mex/oct file
Date: Wed, 28 Mar 2012 04:19:33 -0700 (PDT)

Hi

I've just upgraded to 3.6.1 and discovered the following:

exist('myfile.bla','file)

exits octave with "panic: Segmentation fault -- stopping myself..." IF
myfile is actually a mex file (or presumably oct) file that causes a
segmentation fault. Note that this happens independent of the extension used
(i.e. you don't have to check for 'myfile.mex' or so).

This indicates that exist() actually tries to execute the function, which
sounds really rather dangerous.


I've looked at the C++ source for exist() in variables.cc. This calls
symbol_exist(). I don't know exactly where in this function it executes the
mex file (sorry, I didn't compile a debug version), but I am puzzled by the
fact that this function has special handling for structs in the string  :

  size_t pos = name.find ('.');
  if (pos != std::string::npos && pos > 0)
    {
      struct_elts = name.substr (pos+1);
      symbol_name = name.substr (0, pos);
    }
 octave_value val = safe_symbol_lookup (symbol_name); 

This is probably necessary for some use cases of symbol_exist (but which?)
but definitely not when the type is 'file' (and many others).

Any ideas?

Kris




--
View this message in context: 
http://octave.1599824.n4.nabble.com/bug-in-exist-when-checking-for-a-faulty-mex-oct-file-tp4512006p4512006.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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