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

 
 

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

Submitter:  None
Submitted:  Thu 07 Apr 2011 12:08:19 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  None
Originator Name:  David Bateman Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.4.0
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 19 Apr 2011 12:47:27 AM UTC, comment #4: 
Rik <rik5>
Group 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>
Group 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>
Group 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 Files:
   
   
Comment:
   

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

 

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

    Date Changed by Updated Field Previous Value => Replaced by
    2011-04-19 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2011-04-13 dbateman Attached File- Added changeset2, #23234
    2011-04-13 dbateman Dependencies- bugs #33060 is dependent
    2011-04-12 dbateman Dependencies- Depends on bugs #32182
    2011-04-12 dbateman Carbon-Copy- Added highegg
    2011-04-08 rik5 StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code