1
0

120-upstream-bash43-020.patch 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. BASH PATCH REPORT
  2. =================
  3. Bash-Release: 4.3
  4. Patch-ID: bash43-020
  5. Bug-Reported-by: Jared Yanovich <slovichon@gmail.com>
  6. Bug-Reference-ID: <20140417073654.GB26875@nightderanger.psc.edu>
  7. Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-04/msg00065.html
  8. Bug-Description:
  9. When PS2 contains a command substitution, here-documents entered in an
  10. interactive shell can sometimes cause a segmentation fault.
  11. Patch (apply with `patch -p0'):
  12. --- a/shell.h
  13. +++ b/shell.h
  14. @@ -168,7 +168,8 @@ typedef struct _sh_parser_state_t {
  15. /* flags state affecting the parser */
  16. int expand_aliases;
  17. int echo_input_at_read;
  18. -
  19. + int need_here_doc;
  20. +
  21. } sh_parser_state_t;
  22. typedef struct _sh_input_line_state_t {
  23. --- a/parse.y
  24. +++ b/parse.y
  25. @@ -2642,7 +2642,7 @@ gather_here_documents ()
  26. int r;
  27. r = 0;
  28. - while (need_here_doc)
  29. + while (need_here_doc > 0)
  30. {
  31. parser_state |= PST_HEREDOC;
  32. make_here_document (redir_stack[r++], line_number);
  33. @@ -6075,6 +6075,7 @@ save_parser_state (ps)
  34. ps->expand_aliases = expand_aliases;
  35. ps->echo_input_at_read = echo_input_at_read;
  36. + ps->need_here_doc = need_here_doc;
  37. ps->token = token;
  38. ps->token_buffer_size = token_buffer_size;
  39. @@ -6123,6 +6124,7 @@ restore_parser_state (ps)
  40. expand_aliases = ps->expand_aliases;
  41. echo_input_at_read = ps->echo_input_at_read;
  42. + need_here_doc = ps->need_here_doc;
  43. FREE (token);
  44. token = ps->token;
  45. --- a/y.tab.c
  46. +++ b/y.tab.c
  47. @@ -4954,7 +4954,7 @@ gather_here_documents ()
  48. int r;
  49. r = 0;
  50. - while (need_here_doc)
  51. + while (need_here_doc > 0)
  52. {
  53. parser_state |= PST_HEREDOC;
  54. make_here_document (redir_stack[r++], line_number);
  55. @@ -8387,6 +8387,7 @@ save_parser_state (ps)
  56. ps->expand_aliases = expand_aliases;
  57. ps->echo_input_at_read = echo_input_at_read;
  58. + ps->need_here_doc = need_here_doc;
  59. ps->token = token;
  60. ps->token_buffer_size = token_buffer_size;
  61. @@ -8435,6 +8436,7 @@ restore_parser_state (ps)
  62. expand_aliases = ps->expand_aliases;
  63. echo_input_at_read = ps->echo_input_at_read;
  64. + need_here_doc = ps->need_here_doc;
  65. FREE (token);
  66. token = ps->token;
  67. --- a/patchlevel.h
  68. +++ b/patchlevel.h
  69. @@ -25,6 +25,6 @@
  70. regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
  71. looks for to find the patch level (for the sccs version string). */
  72. -#define PATCHLEVEL 19
  73. +#define PATCHLEVEL 20
  74. #endif /* _PATCHLEVEL_H_ */