cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Stack smashed when linked with pthreads

From: Gary Maxwell <gmaxwell_at_casabi.com>
Date: Fri, 28 Jul 2006 16:03:45 -0700

We recently ported libcurl to an embedded ARM system with microscopic thread
stacks (3-4 kbytes typical) and ran into this problem.

I traced it down to the mprintf module, where local stack frames are large
and the functions can be called recursively. I hacked a change so that the
large stack frame objects were allocated off the heap (heap space is not an
issue), and that solved the problem.

I haven't considered submitting a patch, unless there is general hue and cry
for one.

Gary Maxwell
Casabi

-----Original Message-----
From: Dan Fandrich [mailto:dan_at_coneharvesters.com]
Sent: Friday, July 28, 2006 3:49 PM
To: curl-library_at_cool.haxx.se
Subject: Re: Stack smashed when linked with pthreads

On Fri, Jul 28, 2006 at 03:58:34PM -0500, Marshall Crocker wrote:
> Hmm...that may be it. I'm not exactly sure of my stack size but I am
> using the linux-tiny patches for the 2.6 kernel which may very well
> reduce the size below the default 8K. I assume 8K would be big enough
> to handle curl and pthreads right?

8K is very small. There is at least one place in the curl app where a 64K
buffer is put onto the stack, and I wouldn't be surprised if there are
buffers in the KB range in libcurl. Some of the call stacks can get pretty
deep, so I'd be surprised if you *didn't* see stack overflows at 8K.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2006-07-29