Re: Patch 8.2.4528

2022-03-08 Fir de Conversatie Bram Moolenaar


John Marriott wrote:

> On 09-Mar-2022 03:53, Bram Moolenaar wrote:
> > Patch 8.2.4528
> > Problem:Crash when using null_function for a partial.
> > Solution:   Don't call fname_trans_sid() with NULL. (closes #9908)
> > Files:  src/userfunc.c, src/testdir/test_vim9_func.vim
> >
> >
> After this patch, mingw64 (gcc 11.2.0) throws this warning:
> 
> gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 
> -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO 
> -pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return 
> -fpie -fPIE -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD userfunc.c -o 
> gobjnative/userfunc.o
> userfunc.c: In function 'make_partial':
> userfunc.c:5755:27: warning: 'fp' may be used uninitialized in this 
> function [-Wmaybe-uninitialized]
>   5755 | if ((fp != NULL && (fp->uf_flags & FC_DICT))
>    | ~~^~
> 
> 
> The attached patch tries to fix it.

It actually caused a crash, when I was adding a few more tests.
The fix has been included with 8.2.4529.

-- 
hundred-and-one symptoms of being an internet addict:
208. Your goals for the future are obtaining a second Gbit connection
and upgrade your NAS to all SSD

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///  \\\
\\\sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220308213739.4B0F61C08CF%40moolenaar.net.


Re: Patch 8.2.4528

2022-03-08 Fir de Conversatie John Marriott


On 09-Mar-2022 03:53, Bram Moolenaar wrote:

Patch 8.2.4528
Problem:Crash when using null_function for a partial.
Solution:   Don't call fname_trans_sid() with NULL. (closes #9908)
Files:  src/userfunc.c, src/testdir/test_vim9_func.vim



After this patch, mingw64 (gcc 11.2.0) throws this warning:

gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 
-DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO 
-pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return 
-fpie -fPIE -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD userfunc.c -o 
gobjnative/userfunc.o

userfunc.c: In function 'make_partial':
userfunc.c:5755:27: warning: 'fp' may be used uninitialized in this 
function [-Wmaybe-uninitialized]

 5755 | if ((fp != NULL && (fp->uf_flags & FC_DICT))
  | ~~^~


The attached patch tries to fix it.

Cheers
John

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

--- 
You received this message because you are subscribed to the Google Groups "vim_dev" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/1a0fde44-ae60-14a6-deec-7380b73467f8%40internode.on.net.
--- userfunc.c.orig 2022-03-09 05:24:14.896079100 +1100
+++ userfunc.c  2022-03-09 05:28:17.780679800 +1100
@@ -5730,7 +5730,7 @@
 make_partial(dict_T *selfdict_in, typval_T *rettv)
 {
 char_u  *fname;
-ufunc_T *fp;
+ufunc_T *fp = NULL;
 char_u  fname_buf[FLEN_FIXED + 1];
 int error;
 dict_T  *selfdict = selfdict_in;