bugGNU Octave - Bugs: bug #55258, Recursion in a script file causes...

 
 

bug #55258: Recursion in a script file causes a segmentation fault

Submitted by:  Rob Frohne <frohro>
Submitted on:  Thu 20 Dec 2018 10:14:22 PM UTC  
 
Category:  Interpreter Severity:  4 - Important
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  None
Originator Name:  Rob Frohne Open/Closed:  Closed
Release:  dev Operating System:  GNU/Linux

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Wed 06 Feb 2019 05:41:32 PM UTC, comment #7: 

I don't see why it would need to be reopened, the bug is fixed. The fix was part of a major refactoring of Octave's call stack implementation and cannot be backported to Octave 5. If you need the fix for this you will need to wait for Octave 6 to be released next year.

Mike Miller <mtmiller>
Project Administrator
Wed 06 Feb 2019 04:47:20 PM UTC, comment #6: 

So should this be opened again?

Anonymous
Sun 03 Feb 2019 07:36:26 PM UTC, comment #5: 

Yes, this seems fixed on the default branch, but not on the stable branch for Octave 5.

Here is a modified version of Andy's test case (since pause triggers bug #55029 for me). It crashes immediately after the first key press on the stable branch, but properly recurses and hits the max_recursion_depth error check on the default branch.

(file #46172)

Mike Miller <mtmiller>
Project Administrator
Sun 03 Feb 2019 05:00:00 PM UTC, comment #4: 

I can still reproduce with 5.0.90, 903c9a39e051

Andreas Weber <andy1978>
Project Member
Sun 03 Feb 2019 03:38:28 PM UTC, comment #3: 

I just re-tested with the stable branch (about to become 5.1) and the development branch and this no longer causes a segfault.

Marking as fixed and closing report.

Rik <rik5>
Project Administrator
Sun 30 Dec 2018 09:26:11 PM UTC, comment #2: 

My testcase is file test2.m:

pause
test2

Looks like there is some overflow after calling octave::symbol_record::symbol_record_rep::varval 104339 times.

Backtrace attached

(file #45797)

Andreas Weber <andy1978>
Project Member
Fri 21 Dec 2018 07:39:02 PM UTC, comment #1: 

Confirmed.

Noting that this is a script, not a function file. If I turn test2.m into a function file (simply wrapping the entire contents with 'function test2()' and 'endfunction'), it works as expected. When max_recursion_depth is hit, an error is raised and the whole thing returns.

Also noting that this is a regression from Octave 4.2. In Octave 4.2.2, script recursion works equally well and errors when it reaches max_recursion_depth as expected.

Mike Miller <mtmiller>
Project Administrator
Thu 20 Dec 2018 10:14:22 PM UTC, original submission:  

I have this script called test2.m below.  If I select the cancel button on the file dialog, it will cause a segmentation fault.  If I remove the recursive call to itself, it is fine.

switch (questdlg("Do you wish to load a calibration from disk?"));
case 'Yes'
  calFile = uigetfile();
  if calFile != 0
    load (calFile, 'fMin', 'fMax','nFreq', 'H1thru','H1iso');
  else
    test2;
    return
  endif
  case {'No' 'Cancel'}
    return
end

Rob Frohne <frohro>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #46172:  bug55258.m added by mtmiller (49B - text/x-objcsrc)
file #45797:  backtrace_55258.log added by andy1978 (8KiB - text/x-log)
file #45708:  test2.m added by frohro (257B - text/x-objcsrc)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by andy1978 (Updated the item)
  • -email is unavailable- added by frohro (Submitted the item)
  • -email is unavailable- added by frohro
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-02-03 mtmiller Attached File- => Added bug55258.m, #46172
    2019-02-03 rik5 StatusConfirmed => Fixed
        Open/ClosedOpen => Closed
    2018-12-30 andy1978 Attached File- => Added backtrace_55258.log, #45797
    2018-12-21 mtmiller CategoryNone => Interpreter
        Severity3 - Normal => 4 - Important
        StatusNone => Confirmed
        Release4.4.1 => dev
        SummaryRecursion causes a Segmentation Fault => Recursion in a script file causes a segmentation fault
    2018-12-20 frohro Attached File- => Added test2.m, #45708
        Carbon-Copy- => Added rob.frohne@wallawalla.edu

    Back to the top


    Powered by Savane 3.5