• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/package/bash/bash-4.2-030.patch
Gustavo ZacariasGustavo Zacarias committed 8add5064c3513 Aug 2012
Raw file
Source viewDiff to previous
xxxxxxxxxx
 
1
                 BASH PATCH REPORT
2
                 =================
3
​
4
Bash-Release:   4.2
5
Patch-ID:   bash42-030
6
​
7
Bug-Reported-by:    Roman Rakus <rrakus@redhat.com>
8
Bug-Reference-ID:   <4D7DD91E.7040808@redhat.com>
9
Bug-Reference-URL:  http://lists.gnu.org/archive/html/bug-bash/2011-03/msg00126.html
10
​
11
Bug-Description:
12
​
13
When attempting to glob strings in a multibyte locale, and those strings
14
contain invalid multibyte characters that cause mbsnrtowcs to return 0,
15
the globbing code loops infinitely.
16
​
17
Patch (apply with `patch -p0'):
18
​
19
*** ../bash-4.2-patched/lib/glob/xmbsrtowcs.c   2010-05-30 18:36:27.000000000 -0400
20
--- ./lib/glob/xmbsrtowcs.c 2011-03-22 16:06:47.000000000 -0400
21
***************
22
*** 36,39 ****
23
--- 36,41 ----
24
  #if HANDLE_MULTIBYTE
25
  
26
+ #define WSBUF_INC 32
27
+ 
28
  #ifndef FREE
29
  #  define FREE(x) do { if (x) free (x); } while (0)
30
***************
31
*** 149,153 ****
32
    size_t wcnum;       /* Number of wide characters in WSBUF */
33
    mbstate_t state;    /* Conversion State */
34
!   size_t wcslength;   /* Number of wide characters produced by the conversion. */
35
    const char *end_or_backslash;
36
    size_t nms; /* Number of multibyte characters to convert at one time. */
37
--- 151,155 ----
38
    size_t wcnum;       /* Number of wide characters in WSBUF */
39
    mbstate_t state;    /* Conversion State */
40
!   size_t n, wcslength;    /* Number of wide characters produced by the conversion. */
41
    const char *end_or_backslash;
42
    size_t nms; /* Number of multibyte characters to convert at one time. */
43
***************
44
*** 172,176 ****
45
        tmp_p = p;
46
        tmp_state = state;
47
!       wcslength = mbsnrtowcs(NULL, &tmp_p, nms, 0, &tmp_state);
48
  
49
        /* Conversion failed. */
50
--- 174,189 ----
51
        tmp_p = p;
52
        tmp_state = state;
53
! 
54
!       if (nms == 0 && *p == '\\') /* special initial case */
55
!   nms = wcslength = 1;
56
!       else
57
!   wcslength = mbsnrtowcs (NULL, &tmp_p, nms, 0, &tmp_state);
58
! 
59
!       if (wcslength == 0)
60
!   {
61
!     tmp_p = p;        /* will need below */
62
!     tmp_state = state;
63
!     wcslength = 1;    /* take a single byte */
64
!   }
65
  
66
        /* Conversion failed. */
67
***************
68
*** 187,191 ****
69
      wchar_t *wstmp;
70
  
71
!     wsbuf_size = wcnum+wcslength+1;   /* 1 for the L'\0' or the potential L'\\' */
72
  
73
      wstmp = (wchar_t *) realloc (wsbuf, wsbuf_size * sizeof (wchar_t));
74
--- 200,205 ----
75
      wchar_t *wstmp;
76
  
77
!     while (wsbuf_size < wcnum+wcslength+1) /* 1 for the L'\0' or the potential L'\\' */
78
!       wsbuf_size += WSBUF_INC;
79
  
80
      wstmp = (wchar_t *) realloc (wsbuf, wsbuf_size * sizeof (wchar_t));
81
***************
82
*** 200,207 ****
83
  
84
        /* Perform the conversion. This is assumed to return 'wcslength'.
85
!        * It may set 'p' to NULL. */
86
!       mbsnrtowcs(wsbuf+wcnum, &p, nms, wsbuf_size-wcnum, &state);
87
  
88
!       wcnum += wcslength;
89
  
90
        if (mbsinit (&state) && (p != NULL) && (*p == '\\'))
91
--- 214,229 ----
92
  
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.