Björn Winckler <[email protected]>:

> Hi,
>
> The attached patch fixes a problem where Vim would
> crash when using the Ruby interpreter on Mac OS X 10.7.
>
> The problem is that a call to alloca(size) with len=0 on 10.7
> generates bad code which causes the call stack to be
> messed up.  This patch fixes the problem by checking the
> size before allocating with alloca().  I was tempted to get
> rid of the alloca() call all together and use malloc/free instead,
> but I left that out of the patch.

malloc(0) is not portable either.  It returns NULL on some
platforms (AIX for example) and returns a pointer to an
empty block on most platforms.  So it's best to avoid
allocating 0 bytes, as you did.

-- Dominique

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui