Menu

#227 Segfault on AMD64 platform

open
General (130)
5
2004-05-07
2004-05-07
Anonymous
No

I compiled sodipodi on my AMD64. The compilation went well
but when I start the program I get a segfault.

mario@Leviathan mario $ sodipodi
Segmentatie fout

I tried the use gdb to give some more relavant
information but
it sayd there where no debugging symbols found. :(

I hope this can be fixed soon...

Discussion

  • Jure Repinc

    Jure Repinc - 2004-06-03

    Logged In: YES
    user_id=126758

    Same here :(

     
  • Richard Körber

    Richard Körber - 2004-11-16

    Logged In: YES
    user_id=261141

    Same here... ;( Is there any solution in sight?

     
  • matthieu

    matthieu - 2004-12-21

    Logged In: YES
    user_id=1182431

    I have the same behavior on IA64.
    I really want sodipodi working on it so I will have a look
    on it and try to figure out where the bug is.

     
  • Nobody/Anonymous

    Logged In: NO

    The crash I have append into libnr, when the function
    nr_svp_from_svl is called with both arguments set to 0.

    The function is defined in file src/libnr/nr-svp.c

    When both arguments are set to 0, nsegs value is 0 when the
    following expression is evaluated:
    sizeof (NRSVP) + (nsegs-1) * sizeof (NRSVPSegment)

    The result is a negative value interpreted by malloc as a
    huge value (enar of the maximum).

    I think this is a bug. The 64 bit environment likely change
    the size of both NRSVP and NRSVPSegment from
    sizeof(NRSVP)>sizeof(NRSVPSegment) to the opposit.

    malloc do not honor the allocation request and return a NULL
    pointer.
    The line after the malloc:
    svp->length = nsegs;

    svp contains the pointer returned by malloc and guess what
    append...

    I have no idea what this function is doing and what callers
    are expecting as results thus I don't know what patch to
    submit to handle the case nsegs==0

    However, by changing the previous expression to:
    sizeof (NRSVP) + (nsegs) * sizeof (NRSVPSegment)

    I have this time a positive value and everything works fine.
    As I have no idea how when svp is deallocated, this fix may
    create a memory leak (as I have one more NRSVPSegment
    allocated).

    I think someone with a good knowledge of libnr should be
    able to submit the correct patch.

    However I am happy, I will be able to add a candy cane to my
    logo.

    Merry christmas (if you are "affected") all,

    Matthieu Delahaye

     
  • Richard Körber

    Richard Körber - 2004-12-21

    Logged In: YES
    user_id=261141

    Matthieu, thank you for your great work. Based on this, I
    was able to find out the cause of the segfault.

    The reason is to be found some lines above. "nsegs" was
    defined as "unsigned int". When it had the value 0, though,
    "nsegs - 1" did not result in -1, but in a very large
    positive integer.

    I have changed "nsegs" to be of type "int". After that,
    Sodipodi started without any problems on my AMD64.

    A patch (1089418) has been added to the patches section that
    will fix this.

    What a nice Christmas gift! :-)

     

Log in to post a comment.