109-upstream-bash43-009.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. BASH PATCH REPORT
  2. =================
  3. Bash-Release: 4.3
  4. Patch-ID: bash43-009
  5. Bug-Reported-by: Matthias Klose <doko@debian.org>
  6. Bug-Reference-ID: <53346FC8.6090005@debian.org>
  7. Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-03/msg00171.html
  8. Bug-Description:
  9. There is a problem with unsigned sign extension when attempting to reallocate
  10. the input line when it is fewer than 3 characters long and there has been a
  11. history expansion. The sign extension causes the shell to not reallocate the
  12. line, which results in a segmentation fault when it writes past the end.
  13. Patch (apply with `patch -p0'):
  14. --- a/parse.y
  15. +++ b/parse.y
  16. @@ -2424,7 +2424,7 @@ shell_getc (remove_quoted_newline)
  17. not already end in an EOF character. */
  18. if (shell_input_line_terminator != EOF)
  19. {
  20. - if (shell_input_line_size < SIZE_MAX && shell_input_line_len > shell_input_line_size - 3)
  21. + if (shell_input_line_size < SIZE_MAX-3 && (shell_input_line_len+3 > shell_input_line_size))
  22. shell_input_line = (char *)xrealloc (shell_input_line,
  23. 1 + (shell_input_line_size += 2));
  24. --- a/y.tab.c
  25. +++ b/y.tab.c
  26. @@ -4736,7 +4736,7 @@ shell_getc (remove_quoted_newline)
  27. not already end in an EOF character. */
  28. if (shell_input_line_terminator != EOF)
  29. {
  30. - if (shell_input_line_size < SIZE_MAX && shell_input_line_len > shell_input_line_size - 3)
  31. + if (shell_input_line_size < SIZE_MAX-3 && (shell_input_line_len+3 > shell_input_line_size))
  32. shell_input_line = (char *)xrealloc (shell_input_line,
  33. 1 + (shell_input_line_size += 2));
  34. --- a/patchlevel.h
  35. +++ b/patchlevel.h
  36. @@ -25,6 +25,6 @@
  37. regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
  38. looks for to find the patch level (for the sccs version string). */
  39. -#define PATCHLEVEL 8
  40. +#define PATCHLEVEL 9
  41. #endif /* _PATCHLEVEL_H_ */