#31 Patch for GCC 4.7

closed-accepted
Sam Steingold
None
5
2012-02-02
2012-01-17
Jerry James
No

I maintain the Fedora Clisp package. We were recently asked to compile all of our packages with what will soon be GCC 4.7, in order to find bugs. Clisp built, but failed a socket test on 32-bit x86. The current code uses a get_hostname() macro in socket.d that is unsafe. It creates a character array on the stack, saves a pointer to the first element of the array, exits the scope in which the array is defined, then accesses the (now out of scope) array via the pointer. A C compiler is free to reuse the stack space of out of scope variables, and it appears that GCC 4.7 does in fact do so, at least on 32-bit x86. This is the patch I applied to the Fedora build of Clisp in order to address this issue.

Discussion

  • Jerry James
    Jerry James
    2012-01-17

    Patch to fix accessing an out of scope array

     
    Attachments
  • Sam Steingold
    Sam Steingold
    2012-01-17

    • assigned_to: nobody --> haible
     
  • Sam Steingold
    Sam Steingold
    2012-02-02

    I applied a slightly different patch.
    thanks.

     
  • Sam Steingold
    Sam Steingold
    2012-02-02

    • assigned_to: haible --> sds
    • status: open --> closed-accepted