bugGNU Octave - Bugs: bug #29861, Segmentation fault with surfc

 
 

bug #29861: Segmentation fault with surfc

Submitter:  Rik <rik5>
Submitted:  Tue 11 May 2010 08:54:15 PM UTC
   
 
Category:  Interpreter Severity:  2 - Minor
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 17 May 2010 01:31:53 AM UTC, comment #6: 

I went ahead and committed a patch which checks inputs for the surf* and contour* functions (10634:60542efcfa2c).

Rik <rik5>
Group administrator
Thu 13 May 2010 09:34:15 PM UTC, comment #5: 

I thought about fixing the function cntr in _contourc_.cc, which I think is where the crash actually happens, but I decided to make the other changes because _countourc_ is an internal fucntion and I think we should not have to do extensive input validation on internal functions.  But I don't have any strong objection to someone else improving _contourc_ or _go_surface_ or whatever so that they can't crash on invalid inputs.

John W. Eaton <jwe>
Group administrator
Thu 13 May 2010 07:09:33 PM UTC, comment #4: 

I'm not opposed to fixing _go_surface_, but I think the other fixes in surface.m et al. are also necessary.  It is good practice for any modular code to be defensive and check their inputs for validity before proceeding.

Rik <rik5>
Group administrator
Thu 13 May 2010 06:33:57 PM UTC, comment #3: 

Wouldn't it be better to ix this in _go_surface_ directly? In that way if another function is written that calls _go_surface_ it won't seg-fault either..

D.

David Bateman <dbateman>
Group Member
Wed 12 May 2010 06:53:23 PM UTC, comment #2: 

I've attached a patch which follows your line of coding (ensure Z is a matrix) but piggybacks on the existing argument validations.  The original author (you?) has checks on Z but the issue is that ismatrix returns true for both scalars and vectors.  To truly find a garden variety 2-D matrix one has to ask if it is a matrix and at the same time not one of its subclasses such as scalar or vector. 

If this is acceptable I can work it up to a complete patch.

(file #20525)

Rik <rik5>
Group administrator
Wed 12 May 2010 05:27:03 PM UTC, comment #1: 

I propose the attached patch.  I haven't checked it in as I'm not sure whether it is sufficient to catch all potential problems like this, or whether this is a better way to fix the problem.

(file #20522)

John W. Eaton <jwe>
Group administrator
Tue 11 May 2010 08:54:15 PM UTC, original submission:  

The following code causes a segmentation fault in both the development code and octave 3.0.5.

x = [-8:0.4:8]';
surfc(x)

I realize this is not the correct way to call surfc, but this isn't a reason to segfault.  It seems that the m-file should at least perform minimal validity testing on its arguments and complain rather than abort.

Rik <rik5>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #20525:  surface.m.diff added by rik5 (638B - text/x-diff)
file #20522:  surfc-bug-diffs added by jwe (1KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-05-17 rik5 StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2010-05-13 rik5 StatusNone In Progress
    2010-05-12 rik5 Attached File- Added surface.m.diff, #20525
    2010-05-12 jwe Attached File- Added surfc-bug-diffs, #20522
    2010-05-11 rik5 SummarySegmentation fault Segmentation fault with surfc

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code