octave-maintainers
[Top][All Lists]
Advanced

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

octave-3.0.0+ segmentation fault


From: John W. Eaton
Subject: octave-3.0.0+ segmentation fault
Date: Fri, 04 Jan 2008 14:59:09 -0500

On 31-Dec-2007, Michael Goffioul wrote:

| I just tried to compile and run octave with the object branch merged,
| but it crashes at startup (Windows/MSVC). Error occurs in
| symbol_table::pop_scope (void) when reassigning xcurrent_caller_scope
| (symtab.h, line 660).
| 
| The backtrace is below (copied from vcexpress, might be difficult to
| read), but basically, this happends when sourcing PKG_ADD from
| the base oct-directory, during load_path initialization. When unwinding
| the frame, symbol_table::pop_scope() is called. At that moment,
| scope_stack contains 2 elements. The first statement pops the
| first element, but then the 3rd statement tries to access the element
| at index 1, which is invalid.

Please try the following patch.  I'm not sure it is the best fix, but
it should avoid the problem.  Maybe it would be better to arrange for
scope_stack to always have at least two elements with -1 at the bottom
of the stack.

Thanks,

jwe


src/ChangeLog:

2008-01-04  John W. Eaton  <address@hidden>

        * symtab.h (symbol_table:pop_scope): Avoid accessing beyond end of
        scope_stack.


Index: src/symtab.h
===================================================================
RCS file: /cvs/octave/src/symtab.h,v
retrieving revision 1.93
diff -u -u -r1.93 symtab.h
--- src/symtab.h        28 Dec 2007 20:56:58 -0000      1.93
+++ src/symtab.h        4 Jan 2008 19:57:06 -0000
@@ -657,7 +657,7 @@
 
     set_scope (scope_stack[0]);
 
-    xcurrent_caller_scope = scope_stack[1];
+    xcurrent_caller_scope = scope_stack.size () > 1 ? scope_stack[1] : -1;
   }
 
   static void pop_scope (void *) { pop_scope (); }

reply via email to

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