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

 
 

bug #29861: Segmentation fault with surfc

Submitted by:  Rik <rik5>
Submitted on:  Tue 11 May 2010 08:54:15 PM UTC  
 
Category: InterpreterSeverity: 2 - Minor
Priority: 5 - NormalItem Group: Segfault, Bus Error, etc.
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: devOperating 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 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>
Project 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>
Project 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>
Project 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>
Project 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>
Project 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>
Project 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>
Project Administrator

 

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

Attach File(s):
   
   
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
  • -unavailable- added by dbateman (Posted a comment)
  • -unavailable- added by jwe (Updated the item)
  • -unavailable- added by rik5 (Submitted the item)
  •  

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 17 May 2010 01:31:53 AM UTCrik5StatusIn Progress=>Fixed
      Open/ClosedOpen=>Closed
    Thu 13 May 2010 07:09:33 PM UTCrik5StatusNone=>In Progress
    Wed 12 May 2010 06:53:23 PM UTCrik5Attached File-=>Added surface.m.diff, #20525
    Wed 12 May 2010 05:27:03 PM UTCjweAttached File-=>Added surfc-bug-diffs, #20522
    Tue 11 May 2010 08:54:40 PM UTCrik5SummarySegmentation fault =>Segmentation fault with surfc

    Back to the top


    Powered by Savane 3.1-cleanup1