Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Vim crashes with SEGV when executing :py vim.bindeval("matchstr('', 'x')").
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Yukihiro Nakadaira  
View profile  
 More options Oct 5 2012, 7:06 am
From: Yukihiro Nakadaira <yukihiro.nakada...@gmail.com>
Date: Fri, 5 Oct 2012 20:06:16 +0900
Local: Fri, Oct 5 2012 7:06 am
Subject: Vim crashes with SEGV when executing :py vim.bindeval("matchstr('', 'x')").
Vim crashes with SEGV when executing :py vim.bindeval("matchstr('', 'x')").
And vim.eval("matchstr('', 'x')") returns None.

The following patch fix this problem.
Please check it.

diff -r 61a7c3f01088 src/if_py_both.h
--- a/src/if_py_both.h  Wed Oct 03 21:48:44 2012 +0200
+++ b/src/if_py_both.h  Thu Oct 04 20:44:08 2012 +0900
@@ -351,7 +351,10 @@

     if (our_tv->v_type == VAR_STRING)
     {
-       result = Py_BuildValue("s", our_tv->vval.v_string);
+       if (our_tv->vval.v_string == NULL)
+           result = Py_BuildValue("s", "");
+       else
+           result = Py_BuildValue("s", our_tv->vval.v_string);
     }
     else if (our_tv->v_type == VAR_NUMBER)
     {
@@ -2751,7 +2754,10 @@
     switch (tv->v_type)
     {
        case VAR_STRING:
-           return PyBytes_FromString((char *) tv->vval.v_string);
+           if (tv->vval.v_string == NULL)
+               return PyBytes_FromString("");
+           else
+               return PyBytes_FromString((char *) tv->vval.v_string);
        case VAR_NUMBER:
            return PyLong_FromLong((long) tv->vval.v_number);
 #ifdef FEAT_FLOAT

--
Yukihiro Nakadaira - yukihiro.nakada...@gmail.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bram Moolenaar  
View profile  
 More options Oct 5 2012, 3:11 pm
From: Bram Moolenaar <B...@Moolenaar.net>
Date: Fri, 05 Oct 2012 21:11:06 +0200
Local: Fri, Oct 5 2012 3:11 pm
Subject: Re: Vim crashes with SEGV when executing :py vim.bindeval("matchstr('', 'x')").

Yukihiro Nakadaira wrote:
> Vim crashes with SEGV when executing :py vim.bindeval("matchstr('', 'x')").
> And vim.eval("matchstr('', 'x')") returns None.

> The following patch fix this problem.
> Please check it.

Thanks, I'll include it.  I suppose we should also check for VAR_FUNC.

--
If you only have a hammer, you tend to see every problem as a nail.
If you only have MS-Windows, you tend to solve every problem by rebooting.

 /// Bram Moolenaar -- B...@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Yukihiro Nakadaira  
View profile  
 More options Oct 11 2012, 10:35 am
From: Yukihiro Nakadaira <yukihiro.nakada...@gmail.com>
Date: Thu, 11 Oct 2012 23:35:35 +0900
Local: Thurs, Oct 11 2012 10:35 am
Subject: Re: Vim crashes with SEGV when executing :py vim.bindeval("matchstr('', 'x')").

On Sat, Oct 6, 2012 at 4:11 AM, Bram Moolenaar <B...@moolenaar.net> wrote:

> Yukihiro Nakadaira wrote:

>> Vim crashes with SEGV when executing :py vim.bindeval("matchstr('', 'x')").
>> And vim.eval("matchstr('', 'x')") returns None.

>> The following patch fix this problem.
>> Please check it.

> Thanks, I'll include it.  I suppose we should also check for VAR_FUNC.

Thank you for including it.
Additionally if_mzsch.c and if_lua.c have same code.
Please check and include this.
I didn't do test for if_mzsch.c.

diff -r aa51675adf7e src/if_lua.c
--- a/src/if_lua.c      Fri Oct 05 22:26:30 2012 +0200
+++ b/src/if_lua.c      Thu Oct 11 23:26:25 2012 +0900
@@ -464,7 +464,8 @@
     switch (tv->v_type)
     {
        case VAR_STRING:
-           lua_pushstring(L, (char *) tv->vval.v_string);
+           lua_pushstring(L, tv->vval.v_string == NULL
+                                           ? "" : (char *)tv->vval.v_string);
            break;
        case VAR_NUMBER:
            lua_pushinteger(L, (int) tv->vval.v_number);
diff -r aa51675adf7e src/if_mzsch.c
--- a/src/if_mzsch.c    Fri Oct 05 22:26:30 2012 +0200
+++ b/src/if_mzsch.c    Thu Oct 11 23:26:25 2012 +0900
@@ -2649,7 +2649,8 @@
        new_value = FALSE;
     else if (vim_value->v_type == VAR_STRING)
     {
-       result = scheme_make_string((char *)vim_value->vval.v_string);
+       result = scheme_make_string(vim_value->vval.v_string == NULL
+                                   ? "" : (char *)vim_value->vval.v_string);
        MZ_GC_CHECK();
     }
     else if (vim_value->v_type == VAR_NUMBER)

--
Yukihiro Nakadaira - yukihiro.nakada...@gmail.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bram Moolenaar  
View profile  
 More options Oct 11 2012, 10:55 pm
From: Bram Moolenaar <B...@Moolenaar.net>
Date: Fri, 12 Oct 2012 04:54:18 +0200
Local: Thurs, Oct 11 2012 10:54 pm
Subject: Re: Vim crashes with SEGV when executing :py vim.bindeval("matchstr('', 'x')").

Yukihiro Nakadaira wrote:
> >> Vim crashes with SEGV when executing :py vim.bindeval("matchstr('', 'x')").
> >> And vim.eval("matchstr('', 'x')") returns None.

> >> The following patch fix this problem.
> >> Please check it.

> > Thanks, I'll include it.  I suppose we should also check for VAR_FUNC.

> Thank you for including it.
> Additionally if_mzsch.c and if_lua.c have same code.
> Please check and include this.
> I didn't do test for if_mzsch.c.

Thanks, I'll include this soon.

--
To keep milk from turning sour: Keep it in the cow.

 /// Bram Moolenaar -- B...@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »