Karsten Hopp c16526
To: vim-dev@vim.org
Karsten Hopp c16526
Subject: Patch 7.2.044
Karsten Hopp c16526
Fcc: outbox
Karsten Hopp c16526
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp c16526
Mime-Version: 1.0
Karsten Hopp c16526
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp c16526
Content-Transfer-Encoding: 8bit
Karsten Hopp c16526
------------
Karsten Hopp c16526
Karsten Hopp c16526
Patch 7.2.044
Karsten Hopp c16526
Problem:    Crash because of STRCPY() being over protective of the destination
Karsten Hopp c16526
	    size. (Dominique Pelle)
Karsten Hopp c16526
Solution:   Add -D_FORTIFY_SOURCE=1 to CFLAGS.  Use an intermediate variable
Karsten Hopp c16526
	    for the pointer to avoid a warning.
Karsten Hopp c16526
Files:	    src/auto/configure, src/configure.in, src/eval.c
Karsten Hopp c16526
Karsten Hopp c16526
Karsten Hopp c16526
*** ../vim-7.2.043/src/auto/configure	Thu Jul 24 17:20:50 2008
Karsten Hopp c16526
--- src/auto/configure	Sun Nov 16 17:08:44 2008
Karsten Hopp c16526
***************
Karsten Hopp c16526
*** 16819,16839 ****
Karsten Hopp c16526
    LDFLAGS="$LDFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
Karsten Hopp c16526
  fi
Karsten Hopp c16526
  
Karsten Hopp c16526
- { $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&5
Karsten Hopp c16526
- $as_echo_n "checking for GCC 3 or later... " >&6; }
Karsten Hopp c16526
  DEPEND_CFLAGS_FILTER=
Karsten Hopp c16526
  if test "$GCC" = yes; then
Karsten Hopp c16526
    gccmajor=`echo "$gccversion" | sed -e 's/^\([1-9]\)\..*$/\1/g'`
Karsten Hopp c16526
    if test "$gccmajor" -gt "2"; then
Karsten Hopp c16526
      DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
Karsten Hopp c16526
!   fi
Karsten Hopp c16526
! fi
Karsten Hopp c16526
! if test "$DEPEND_CFLAGS_FILTER" = ""; then
Karsten Hopp c16526
!   { $as_echo "$as_me:$LINENO: result: no" >&5
Karsten Hopp c16526
  $as_echo "no" >&6; }
Karsten Hopp c16526
! else
Karsten Hopp c16526
!   { $as_echo "$as_me:$LINENO: result: yes" >&5
Karsten Hopp c16526
  $as_echo "yes" >&6; }
Karsten Hopp c16526
  fi
Karsten Hopp c16526
  
Karsten Hopp c16526
  
Karsten Hopp c16526
--- 16819,16847 ----
Karsten Hopp c16526
    LDFLAGS="$LDFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
Karsten Hopp c16526
  fi
Karsten Hopp c16526
  
Karsten Hopp c16526
  DEPEND_CFLAGS_FILTER=
Karsten Hopp c16526
  if test "$GCC" = yes; then
Karsten Hopp c16526
+   { $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&5
Karsten Hopp c16526
+ $as_echo_n "checking for GCC 3 or later... " >&6; }
Karsten Hopp c16526
    gccmajor=`echo "$gccversion" | sed -e 's/^\([1-9]\)\..*$/\1/g'`
Karsten Hopp c16526
    if test "$gccmajor" -gt "2"; then
Karsten Hopp c16526
      DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
Karsten Hopp c16526
!     { $as_echo "$as_me:$LINENO: result: yes" >&5
Karsten Hopp c16526
! $as_echo "yes" >&6; }
Karsten Hopp c16526
!   else
Karsten Hopp c16526
!     { $as_echo "$as_me:$LINENO: result: no" >&5
Karsten Hopp c16526
  $as_echo "no" >&6; }
Karsten Hopp c16526
!   fi
Karsten Hopp c16526
!       { $as_echo "$as_me:$LINENO: checking whether we need -D_FORTIFY_SOURCE=1" >&5
Karsten Hopp c16526
! $as_echo_n "checking whether we need -D_FORTIFY_SOURCE=1... " >&6; }
Karsten Hopp c16526
!   if test "$gccmajor" -gt "3"; then
Karsten Hopp c16526
!     CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1"
Karsten Hopp c16526
!     { $as_echo "$as_me:$LINENO: result: yes" >&5
Karsten Hopp c16526
  $as_echo "yes" >&6; }
Karsten Hopp c16526
+   else
Karsten Hopp c16526
+     { $as_echo "$as_me:$LINENO: result: no" >&5
Karsten Hopp c16526
+ $as_echo "no" >&6; }
Karsten Hopp c16526
+   fi
Karsten Hopp c16526
  fi
Karsten Hopp c16526
  
Karsten Hopp c16526
  
Karsten Hopp c16526
*** ../vim-7.2.043/src/configure.in	Thu Jul 24 17:20:31 2008
Karsten Hopp c16526
--- src/configure.in	Sun Nov 16 17:08:40 2008
Karsten Hopp c16526
***************
Karsten Hopp c16526
*** 3152,3169 ****
Karsten Hopp c16526
  dnl But only when making dependencies, cproto and lint don't take "-isystem".
Karsten Hopp c16526
  dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
Karsten Hopp c16526
  dnl the number before the version number.
Karsten Hopp c16526
- AC_MSG_CHECKING(for GCC 3 or later)
Karsten Hopp c16526
  DEPEND_CFLAGS_FILTER=
Karsten Hopp c16526
  if test "$GCC" = yes; then
Karsten Hopp c16526
    gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
Karsten Hopp c16526
    if test "$gccmajor" -gt "2"; then
Karsten Hopp c16526
      DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
Karsten Hopp c16526
    fi
Karsten Hopp c16526
- fi
Karsten Hopp c16526
- if test "$DEPEND_CFLAGS_FILTER" = ""; then
Karsten Hopp c16526
-   AC_MSG_RESULT(no)
Karsten Hopp c16526
- else
Karsten Hopp c16526
-   AC_MSG_RESULT(yes)
Karsten Hopp c16526
  fi
Karsten Hopp c16526
  AC_SUBST(DEPEND_CFLAGS_FILTER)
Karsten Hopp c16526
  
Karsten Hopp c16526
--- 3152,3176 ----
Karsten Hopp c16526
  dnl But only when making dependencies, cproto and lint don't take "-isystem".
Karsten Hopp c16526
  dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
Karsten Hopp c16526
  dnl the number before the version number.
Karsten Hopp c16526
  DEPEND_CFLAGS_FILTER=
Karsten Hopp c16526
  if test "$GCC" = yes; then
Karsten Hopp c16526
+   AC_MSG_CHECKING(for GCC 3 or later)
Karsten Hopp c16526
    gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
Karsten Hopp c16526
    if test "$gccmajor" -gt "2"; then
Karsten Hopp c16526
      DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
Karsten Hopp c16526
+     AC_MSG_RESULT(yes)
Karsten Hopp c16526
+   else
Karsten Hopp c16526
+     AC_MSG_RESULT(no)
Karsten Hopp c16526
+   fi
Karsten Hopp c16526
+   dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
Karsten Hopp c16526
+   dnl declared as char x[1] but actually longer.  Introduced in gcc 4.0.
Karsten Hopp c16526
+   AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
Karsten Hopp c16526
+   if test "$gccmajor" -gt "3"; then
Karsten Hopp c16526
+     CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1"
Karsten Hopp c16526
+     AC_MSG_RESULT(yes)
Karsten Hopp c16526
+   else
Karsten Hopp c16526
+     AC_MSG_RESULT(no)
Karsten Hopp c16526
    fi
Karsten Hopp c16526
  fi
Karsten Hopp c16526
  AC_SUBST(DEPEND_CFLAGS_FILTER)
Karsten Hopp c16526
  
Karsten Hopp c16526
*** ../vim-7.2.043/src/eval.c	Wed Nov 12 15:28:37 2008
Karsten Hopp c16526
--- src/eval.c	Sun Nov 16 20:46:28 2008
Karsten Hopp c16526
***************
Karsten Hopp c16526
*** 21150,21157 ****
Karsten Hopp c16526
      init_var_dict(&fc.l_avars, &fc.l_avars_var);
Karsten Hopp c16526
      add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "0",
Karsten Hopp c16526
  				(varnumber_T)(argcount - fp->uf_args.ga_len));
Karsten Hopp c16526
      v = &fc.fixvar[fixvar_idx++].var;
Karsten Hopp c16526
!     STRCPY(v->di_key, "000");
Karsten Hopp c16526
      v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
Karsten Hopp c16526
      hash_add(&fc.l_avars.dv_hashtab, DI2HIKEY(v));
Karsten Hopp c16526
      v->di_tv.v_type = VAR_LIST;
Karsten Hopp c16526
--- 21150,21160 ----
Karsten Hopp c16526
      init_var_dict(&fc.l_avars, &fc.l_avars_var);
Karsten Hopp c16526
      add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "0",
Karsten Hopp c16526
  				(varnumber_T)(argcount - fp->uf_args.ga_len));
Karsten Hopp c16526
+     /* Use "name" to avoid a warning from some compiler that checks the
Karsten Hopp c16526
+      * destination size. */
Karsten Hopp c16526
      v = &fc.fixvar[fixvar_idx++].var;
Karsten Hopp c16526
!     name = v->di_key;
Karsten Hopp c16526
!     STRCPY(name, "000");
Karsten Hopp c16526
      v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
Karsten Hopp c16526
      hash_add(&fc.l_avars.dv_hashtab, DI2HIKEY(v));
Karsten Hopp c16526
      v->di_tv.v_type = VAR_LIST;
Karsten Hopp c16526
*** ../vim-7.2.043/src/version.c	Thu Nov 20 10:26:19 2008
Karsten Hopp c16526
--- src/version.c	Thu Nov 20 10:34:31 2008
Karsten Hopp c16526
***************
Karsten Hopp c16526
*** 678,679 ****
Karsten Hopp c16526
--- 678,681 ----
Karsten Hopp c16526
  {   /* Add new patch number below this line */
Karsten Hopp c16526
+ /**/
Karsten Hopp c16526
+     44,
Karsten Hopp c16526
  /**/
Karsten Hopp c16526
Karsten Hopp c16526
-- 
Karsten Hopp c16526
Error:015 - Unable to exit Windows.  Try the door.
Karsten Hopp c16526
Karsten Hopp c16526
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp c16526
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp c16526
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp c16526
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///