Hi char101!

On Sa, 02 Jun 2012, char101 wrote:

> Hi,
> 
> Lately I have been getting rather frequent crash with gvim. It seems to 
> happen randomly. I do have a debug info of the crash. Unfortunately I cannot 
> find what is causing the crash by looking at the debug info. Can anyone help 
> me finding the problem that made gvim crash?
> 
> Crash info:
> 
> (c70.1018): Access violation - code c0000005 (!!! second chance !!!)
> eax=01cfb950 ebx=00000000 ecx=00000000 edx=00000000 esi=00000000 edi=0012e418
> eip=00438bed esp=0012dab0 ebp=0012df24 iopl=0         nv up ei pl nz na pe nc
> cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000206
> gvim!call_user_func+0x8d:
> 00438bed 8903            mov     dword ptr [ebx],eax  
> ds:0023:00000000=????????
> 0:000> ub
> gvim!call_user_func+0x6c [eval.c @ 22225]:
> 00438bcc 6808060000      push    608h
> 00438bd1 e87a7d0600      call    gvim!lalloc (004a0950)
> 00438bd6 8b0d08db5500    mov     ecx,dword ptr [gvim!current_funccal 
> (0055db08)]
> 00438bdc 8b1508df5500    mov     edx,dword ptr [gvim!ex_nesting_level 
> (0055df08)]
> 00438be2 8bd8            mov     ebx,eax
> 00438be4 8b4508          mov     eax,dword ptr [ebp+8]
> 00438be7 56              push    esi
> 00438be8 68fc4b5500      push    offset gvim!dbg_breakp (00554bfc)
> 
> It seems that since ebx is 0, vim is trying to access zero pointer. But I 
> cannot find which pointer is it.
> 
> Source code where the crash happen
> 
>     fc = (funccall_T *)alloc(sizeof(funccall_T));
>     fc->caller = current_funccal;
>     current_funccal = fc;
>     fc->func = fp;
>     fc->rettv = rettv;
>     rettv->vval.v_number = 0;
>     fc->linenr = 0;
>     fc->returned = FALSE;
>     fc->level = ex_nesting_level;
>     /* Check if this function has a breakpoint. */
>     fc->breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0); 
> <--- crash here
>     fc->dbg_tick = debug_tick;

My guess is, that the alloc failed and returned NULL.

Perhaps this patch helps to avoid it:

diff --git a/src/eval.c b/src/eval.c
--- a/src/eval.c
+++ b/src/eval.c
@@ -22227,6 +22227,13 @@
     line_breakcheck();         /* check for CTRL-C hit */
 
     fc = (funccall_T *)alloc(sizeof(funccall_T));
+    if (fc == NULL)
+    {
+       do_outofmem_msg((long_u) sizeof(funccall_T));
+       rettv->v_type = VAR_NUMBER;
+       rettv->vval.v_number = -1;
+       return;
+    }
     fc->caller = current_funccal;
     current_funccal = fc;
     fc->func = fp;


regards,
Christian
-- 
Evolution ist die Entwicklung vom Tümpel in den Fernsehsessel.
                -- Erwin Pelzig

-- 
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