Patch 8.0.1254
Problem:    Undefined left shift in gethexchrs(). (geeknik)
Solution:   Use unsigned long. (idea by Christian Brabandt, closes #2255)
Files:      src/regexp.c, src/regexp_nfa.c


*** ../vim-8.0.1253/src/regexp.c        2017-10-24 21:49:32.234837736 +0200
--- src/regexp.c        2017-11-02 22:18:35.864197402 +0100
***************
*** 695,703 ****
  static int    peekchr(void);
  static void   skipchr(void);
  static void   ungetchr(void);
! static int    gethexchrs(int maxinputlen);
! static int    getoctchrs(void);
! static int    getdecchrs(void);
  static int    coll_get_char(void);
  static void   regcomp_start(char_u *expr, int flags);
  static char_u *reg(int, int *);
--- 695,703 ----
  static int    peekchr(void);
  static void   skipchr(void);
  static void   ungetchr(void);
! static long   gethexchrs(int maxinputlen);
! static long   getoctchrs(void);
! static long   getdecchrs(void);
  static int    coll_get_char(void);
  static void   regcomp_start(char_u *expr, int flags);
  static char_u *reg(int, int *);
***************
*** 1837,1843 ****
        case Magic('@'):
            {
                int     lop = END;
!               int     nr;
  
                nr = getdecchrs();
                switch (no_Magic(getchr()))
--- 1837,1843 ----
        case Magic('@'):
            {
                int     lop = END;
!               long    nr;
  
                nr = getdecchrs();
                switch (no_Magic(getchr()))
***************
*** 2278,2284 ****
                case 'u':   /* %uabcd hex 4 */
                case 'U':   /* %U1234abcd hex 8 */
                          {
!                             int i;
  
                              switch (c)
                              {
--- 2278,2284 ----
                case 'u':   /* %uabcd hex 4 */
                case 'U':   /* %U1234abcd hex 8 */
                          {
!                             long i;
  
                              switch (c)
                              {
***************
*** 3274,3283 ****
   * The parameter controls the maximum number of input characters. This will be
   * 2 when reading a \%x20 sequence and 4 when reading a \%u20AC sequence.
   */
!     static int
  gethexchrs(int maxinputlen)
  {
!     int               nr = 0;
      int               c;
      int               i;
  
--- 3274,3283 ----
   * The parameter controls the maximum number of input characters. This will be
   * 2 when reading a \%x20 sequence and 4 when reading a \%u20AC sequence.
   */
!     static long
  gethexchrs(int maxinputlen)
  {
!     long_u    nr = 0;
      int               c;
      int               i;
  
***************
*** 3293,3309 ****
  
      if (i == 0)
        return -1;
!     return nr;
  }
  
  /*
   * Get and return the value of the decimal string immediately after the
   * current position. Return -1 for invalid.  Consumes all digits.
   */
!     static int
  getdecchrs(void)
  {
!     int               nr = 0;
      int               c;
      int               i;
  
--- 3293,3309 ----
  
      if (i == 0)
        return -1;
!     return (long)nr;
  }
  
  /*
   * Get and return the value of the decimal string immediately after the
   * current position. Return -1 for invalid.  Consumes all digits.
   */
!     static long
  getdecchrs(void)
  {
!     long_u    nr = 0;
      int               c;
      int               i;
  
***************
*** 3320,3326 ****
  
      if (i == 0)
        return -1;
!     return nr;
  }
  
  /*
--- 3320,3326 ----
  
      if (i == 0)
        return -1;
!     return (long)nr;
  }
  
  /*
***************
*** 3331,3340 ****
   *     blahblah\%o210asdf
   *       before-^  ^-after
   */
!     static int
  getoctchrs(void)
  {
!     int               nr = 0;
      int               c;
      int               i;
  
--- 3331,3340 ----
   *     blahblah\%o210asdf
   *       before-^  ^-after
   */
!     static long
  getoctchrs(void)
  {
!     long_u    nr = 0;
      int               c;
      int               i;
  
***************
*** 3350,3356 ****
  
      if (i == 0)
        return -1;
!     return nr;
  }
  
  /*
--- 3350,3356 ----
  
      if (i == 0)
        return -1;
!     return (long)nr;
  }
  
  /*
***************
*** 3360,3366 ****
      static int
  coll_get_char(void)
  {
!     int           nr = -1;
  
      switch (*regparse++)
      {
--- 3360,3366 ----
      static int
  coll_get_char(void)
  {
!     long      nr = -1;
  
      switch (*regparse++)
      {
*** ../vim-8.0.1253/src/regexp_nfa.c    2017-10-24 21:49:32.234837736 +0200
--- src/regexp_nfa.c    2017-11-02 22:22:26.954796218 +0100
***************
*** 1522,1528 ****
                case 'u':   /* %uabcd hex 4 */
                case 'U':   /* %U1234abcd hex 8 */
                    {
!                       int nr;
  
                        switch (c)
                        {
--- 1522,1528 ----
                case 'u':   /* %uabcd hex 4 */
                case 'U':   /* %U1234abcd hex 8 */
                    {
!                       long nr;
  
                        switch (c)
                        {
***************
*** 2040,2046 ****
      int               greedy = TRUE;      /* Braces are prefixed with '-' ? */
      parse_state_T old_state;
      parse_state_T new_state;
!     int               c2;
      int               old_post_pos;
      int               my_post_start;
      int               quest;
--- 2040,2046 ----
      int               greedy = TRUE;      /* Braces are prefixed with '-' ? */
      parse_state_T old_state;
      parse_state_T new_state;
!     long      c2;
      int               old_post_pos;
      int               my_post_start;
      int               quest;
*** ../vim-8.0.1253/src/version.c       2017-11-02 21:04:17.991345051 +0100
--- src/version.c       2017-11-02 22:19:56.095710528 +0100
***************
*** 763,764 ****
--- 763,766 ----
  {   /* Add new patch number below this line */
+ /**/
+     1254,
  /**/

-- 
Citizens are not allowed to attend a movie house or theater nor ride in a
public streetcar within at least four hours after eating garlic.
                [real standing law in Indiana, United States of America]

 /// 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 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.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui