bugGNU Octave - Bugs: bug #57244, Octave crashes if first command at...

 
 

bug #57244: Octave crashes if first command at debug prompt is empty

Submitter:  Markus Mützel <mmuetzel>
Submitted:  Sat 16 Nov 2019 05:17:04 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 16 Dec 2019 06:04:14 PM UTC, comment #11: 

This is working.  Marking as fixed and closing report.

Rik <rik5>
Group administrator
Tue 10 Dec 2019 06:08:26 AM UTC, comment #10: 

I don't claim to fully understand how it should be working.

CC'ing jwe because I hope he'll better know if this check is enough. Or maybe we'll need other changes to ensure that the shared statement_list pointer of the push_parser class is never null in the first place.

Markus Mützel <mmuetzel>
Group administrator
Mon 09 Dec 2019 09:05:22 PM UTC, comment #9: 

Works for me! Thanks for fixing, Markus.
I wasn't sure if a test of stmt_list would be enough or if stmt_list shouldn't be the nullptr here.

Torsten Lilge <ttl>
Group Member
Sun 08 Dec 2019 09:08:03 PM UTC, comment #8: 

The following change fixes the issue for me:
http://hg.savannah.gnu.org/hgweb/octave/rev/d8c53771645c

Thanks for tracking this down.

Marking as ready for test.

Markus Mützel <mmuetzel>
Group administrator
Sun 08 Dec 2019 06:53:45 PM UTC, comment #7: 

I think the difference is that "source ()" is not executed before it is acknowledged by "return", thus in this case, the first command is not empty anymore.

Torsten Lilge <ttl>
Group Member
Sun 08 Dec 2019 06:10:02 PM UTC, comment #6: 

I can't reproduce with the following steps:

dbstop plot
plot ([0 1])
source ("some_script_file.m")  # This executes correctly
## no amount of pressing <return> causes an issue


The steps from comment #0 still cause a crash.

Does "Fsource" something different than calling "source" at the command prompt?

Markus Mützel <mmuetzel>
Group administrator
Fri 29 Nov 2019 10:07:14 AM UTC, comment #5: 

This seems like the same than bug #57234: 'dbquit' is mentioned there but typing <return> only is enough to reproduce the issue.

Guillaume <gyom>
Fri 29 Nov 2019 05:48:54 AM UTC, comment #4: 

The crash even happens for me in the gui and cli version if the first command that is executed at the debug prompt is empty, i.e. if only <return> is pressed.

Changing title  and category accordingly.

Torsten Lilge <ttl>
Group Member
Mon 25 Nov 2019 08:04:27 PM UTC, comment #3: 

After some testing, the bug boils down to the sequence


Fsource ();   // or interp.source_file ();
command_editor::accept_line ();


while being in debug mode. This affects the use of F9 but also running a file from the files dock widget when the file name is not a valid identifier (e.g., "a-b.m"), because source_file () is used in both cases. The segfault actually occurs in pt-eval.cc, line 2770, obviously due to a non valid tree_statement_list.

When calling Fsource () without the following accpet_line (), the segfault is triggered by the next <return> in the terminal.

The segfault does not happen, if another command was executed at the debug prompt before. However in this case, this command is repeated in addition to the file ran by Fsource (). It looks like Fsource triggers another command in the recent debug mode history resulting in a segfault when the recent command is still empty.

I am changing the title of the report to better reflect the issue.

Torsten Lilge <ttl>
Group Member
Sun 17 Nov 2019 08:17:37 PM UTC, comment #2: 

Confirmed on Debian with simple  "a = 1" as selected code.

Torsten Lilge <ttl>
Group Member
Sat 16 Nov 2019 11:31:43 PM UTC, comment #1: 

Confirmed on Windows.
I can only get the crash if I try to "execute" a function argument. Most other code just executes fine AFAICS.

with Octave-5.1.0 I get no crashes.

Philip Nienhuis <philipnienhuis>
Group Member
Sat 16 Nov 2019 05:17:04 PM UTC, original submission:  

When using F9 to execute code while in debug mode, Octave crashes with a segmentation fault.

Steps to reproduce:

dbstop plot
plot ([0 1])
# Mark any code in the editor (e.g. "varargin") and hit F9.


Happens for me on Ubuntu and Windows.

Markus Mützel <mmuetzel>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

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 mmuetzel
  • -email is unavailable- added by gyom (Posted a comment)
  • -email is unavailable- added by ttl (Posted a comment)
  • -email is unavailable- added by mmuetzel (Submitted the item)
  • -email is unavailable- added by mmuetzel
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-12-16 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2019-12-10 mmuetzel Carbon-Copy- Added jwe
    2019-12-08 mmuetzel StatusConfirmed Ready For Test
    2019-11-29 ttl CategoryGUI Interpreter
        Assigned tottl None
        SummaryUse of Fsource () in debug mode crashes octave Octave crashes if first command at debug prompt is empty
    2019-11-25 ttl SummaryF9 in debug mode crashes the GUI Use of Fsource () in debug mode crashes octave
    2019-11-17 ttl Assigned toNone ttl
    2019-11-16 philipnienhuis StatusNone Confirmed
    2019-11-16 mmuetzel Carbon-Copy- Added ttl

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code