Menu

#1 segmentation fault

open
nobody
None
5
2009-12-05
2009-12-05
Anonymous
No

Receive segmentation fault from sdcclib due to a bad memory access when making fx2.lib.

Using sdcclib v1.2 and sdcc v2.9.0 on Mac OS X i386 (Snow Leopard v10.6.2).

Do not receive this error when using sdcclib for building other libraries, also for the FX2.

Discussion

  • Chris Hiszpanski

    This is a problem with sdcclib, not fx2lib. In particular, line 61 in version 1.2 of sdcclib is:

    for(; (path[i]!='\\')&&(path[i]!='/')&&(i>=0); i--);

    When i = -1, path[-1] will be accessed before the i>=0 check exits the loop. A work around is to generate a temporary build directory for your .rel files and call sdcclib as:

    sdcclib fx2.lib build/serial.rel i2c.rel ...

    The loop will terminate when it reaches the '/', before i == -1.

    However, to fix the bug in sdcclib, change the line to:

    for(; (i>=0)&&(path[i]!='\\')&&(path[i]!='/'); i--);

    This is patch #2788108 in the sdcc project:

    http://sourceforge.net/tracker/?func=detail&aid=2788108&group_id=599&atid=300599

    We should see it in the next version.

     
  • Chris Hiszpanski

    Correction on my last post, should be:

    sdcc fx2.lib build/serial.rel build/i2c.rel ...

     
  • Maarten Brock

    Maarten Brock - 2013-01-25

    Since the patch was applied and also a new release of SDCC (actually several by now) has been made, can't this be closed?

     

Log in to post a comment.