bugGuile - Bugs: bug #25525, Segfault using goops

 
 

bug #25525: Segfault using goops

Submitted by:  Michael Burschik <burschik>
Submitted on:  Mon 09 Feb 2009 08:25:50 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

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)

Thu 20 Oct 2011 10:32:07 PM UTC, comment #8:

Thank you for the fix, Stefan. I have pushed it to git along with a test case.

Andy Wingo <wingo>
Project Administrator
Mon 05 Sep 2011 12:25:21 PM UTC, comment #7:

added goops4.diff, a git diff that fixes c stylish errors and use
scm_is_eq in stead of a direct comparision.

/Stefan

(file #23943)

Stefan Israelsson Tampe <tampe>
Project Member
Sun 21 Aug 2011 10:54:42 AM UTC, comment #6:

I recognized that the layout problem appears as well if you inherit
from first <class> and then a class <b> which does not contain <class> I did fix this. By postponing the addition of <class> variables to the last in order for them to always get the correct
index in the layout.

So, now
(1) you can inheret meta objects from both <class> and non <class> objects

(2) it's not possible to inherit or add variables that have the same name as <class> variables. If that is tried an error is signaled.

For a git-diff, see goopsdiff2 below

(file #23843)

Stefan Israelsson Tampe <tampe>
Project Member
Sat 20 Aug 2011 06:14:56 PM UTC, comment #5:

Ok, I did an attempt to make an acceptable fix to this.

The problem was that in <class> the name slot order of the layout
changed due to the new slot again called name. This cassed lookup code that assumes a fixed layout to fetch the wrong values due to a shift of the layout. The added fix will, at class creation, verify if the class is deducing <class>. If so and there is an attempt to add a new slot named already defined by <class>, an error will be signaled, see result below,

scheme@(guile-user)> (define-class <test-class> (<class>) name)
ERROR: In procedure %compute-slots:
ERROR: In procedure init-object: a predefined <class> inherrited field cannot be redefined

Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]>

A patch includeing some solidification of the code by making sure
a pair is used where it is assumed it does is added as well.

See goopsdiff diff below.

(file #23840)

Stefan Israelsson Tampe <tampe>
Project Member
Mon 07 Jun 2010 10:00:36 AM UTC, comment #4:

This bug is still present in git.

Andy Wingo <wingo>
Project Administrator
Fri 16 Apr 2010 11:36:47 AM UTC, comment #3:

a cut and paste bug, the function is
build_slots_list in goops.c

Anyhow I saw that I can enable a pair test, with a debug option in the compilation.

So, as always, people are smart.

Stefan Israelsson Tampe <tampe>
Project Member
Fri 16 Apr 2010 11:26:07 AM UTC, comment #2:

The reason is that code assume cpl to be a null terminated list but it's not due to the bug, then a cdr will make the crash. Now this is a symptom and not the cause. But we can avoid a segmentation fault by making sure that we check for a pair although it will slow down the algorithm a little. Checking for a pairs and silently move on if error yield an error in a layout check!

Better to fix the cause, right? Well to raise a question. by coding for efficiency and assume that the code will be used correctly we will gain speed. On the other hand this means that
any bug will, with maybe to high probability, crash the repl.

I would prefere to use fast and unsecure paths only for proven
datastructures. Or, next best, use checks that is on only under a debug compile!

Stefan Israelsson Tampe <tampe>
Project Member
Mon 09 Feb 2009 11:17:12 PM UTC, comment #1:

In case it helps until this is fixed properly...

This appears to be specific to the combination of
- the use of "name" in the definition of <test-class>
- the use of <class> as a superclass.

I would guess related to the fact that <class> already has a slot called "name".

Neil Jerram <ossau>
Project Administrator
Mon 09 Feb 2009 08:25:50 AM UTC, original submission:

(use-modules (oop goops))

(define-class <test-class> (<class>)
name)

(make <test-class>)

This makes guile 1.8.5 crash with a segmentation fault on Linux.

Michael Burschik <burschik>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #23943:  goops4.diff added by tampe (4KiB - text/x-patch)
file #23843:  goopsdiff2.diff added by tampe (4KiB - text/x-patch)
file #23840:  goopsdiff.diff added by tampe (4KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by wingo (Posted a comment)
  • -unavailable- added by tampe (Posted a comment)
  • -unavailable- added by ossau (Posted a comment)
  • -unavailable- added by burschik (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 logged-in users can vote.

     

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

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 20 Oct 2011 10:32:07 PM UTCwingoStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Mon 05 Sep 2011 12:25:21 PM UTCtampeAttached File-=>Added goops4.diff, #23943
    Sun 21 Aug 2011 10:54:42 AM UTCtampeAttached File-=>Added goopsdiff2.diff, #23843
    Sat 20 Aug 2011 06:14:56 PM UTCtampeAttached File-=>Added goopsdiff.diff, #23840

    Back to the top


    Powered by Savane 3.1-cleanup1