bugGNU Octave - Bugs: bug #33014, Assignment of a class to a scalar...

 
 

bug #33014: Assignment of a class to a scalar structure seg faults

Submitted by:  None
Submitted on:  Thu 07 Apr 2011 12:08:19 PM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Segfault, Bus Error, etc.
Status: FixedAssigned to: None
Originator Name: David BatemanOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 3.4.0
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.

 

Tue 19 Apr 2011 12:47:27 AM UTC, comment #4:

Applied in this changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/6f3f18957851)

Rik <rik5>
Project Administrator
Wed 13 Apr 2011 02:29:33 PM UTC, comment #3:

After a bit more testing it appears that a better fix is the attached changeset (to apply after my changeset in #33062). Can someone apply this and I'll close this bug.

David

(file #23234)

David Bateman <dbateman>
Project Member
Tue 12 Apr 2011 03:39:03 PM UTC, comment #2:

Ok a fix that addresses this bug completely while still addressing the big #32182 is

--- src/ov-class.cc~ 2011-02-08 11:00:52.000000000 +0100
+++ src/ov-class.cc 2011-04-05 23:26:56.000000000 +0200
@@ -125,7 +125,7 @@

// Here we are just looking to see if FCN is a method or constructor
// for any class, not specifically this one.
- if (fcn->is_class_method () || fcn->is_class_constructor ())
+ if (fcn && (fcn->is_class_method () || ! fcn->is_class_constructor ()))
retval = fcn->dispatch_class ();

However, I'm really not sure that this is the right fix. Jaroslav, could you confirm that this is the right thing to do?

D.

PS. (bit the bullet and requested a password change on savannah so I no longer have to post anonymously)

David Bateman <dbateman>
Project Member
Fri 08 Apr 2011 02:00:39 PM UTC, comment #1:

A simple fix is

--- src/ov-class.cc~ 2011-02-08 11:00:52.000000000 +0100
+++ src/ov-class.cc 2011-04-05 23:26:56.000000000 +0200
@@ -125,7 +125,7 @@

// Here we are just looking to see if FCN is a method or constructor
// for any class, not specifically this one.
- if (fcn->is_class_method () || fcn->is_class_constructor ())
+ if (fcn && (fcn->is_class_method () || fcn->is_class_constructor ()))
retval = fcn->dispatch_class ();

return retval;

This fixes my original problem with the segfault. However,I then see another problem. If I then create a class "testobj" with the constructor

function a = testobj ()
a.b(1) = ftp('ftp.octave.org');
endfunction

I get the error

error: malformed class
error: assignment to structure element failed
error: assignment failed, or no method for `<unknown type> = class'
error: called from:
error: /home/dbateman/@testobj/testobj.m at line 2, column 8

D.

Anonymous
Thu 07 Apr 2011 12:08:19 PM UTC, original submission:

Consider the code

a.b(1) = ftp("ftp.octave.org")

On my machine this generates a segfault during the assignment to the scalar structure

D.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #23234:  changeset2 added by dbateman (2KiB - application/octet-stream)

 

Digest:
   bug dependencies.

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -unavailable- added by dbateman (Posted a comment)
  • -unavailable- added by dbateman
  • -unavailable- added by rik5 (Updated the item)
  • -unavailable- added by None (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 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 19 Apr 2011 12:47:27 AM UTCrik5StatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Wed 13 Apr 2011 02:29:33 PM UTCdbatemanAttached File-=>Added changeset2, #23234
    Wed 13 Apr 2011 02:27:46 PM UTCdbatemanDependencies-=>bugs #33060 is dependent
    Tue 12 Apr 2011 03:39:52 PM UTCdbatemanDependencies-=>Depends on bugs #32182
    Tue 12 Apr 2011 03:39:03 PM UTCdbatemanCarbon-Copy-=>Added highegg
    Fri 08 Apr 2011 04:21:10 AM UTCrik5StatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1