readline52-002.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. READLINE PATCH REPORT
  2. =====================
  3. Readline-Release: 5.2
  4. Patch-ID: readline52-002
  5. Bug-Reported-by: Magnus Svensson <msvensson@mysql.com>
  6. Bug-Reference-ID: <45BDC44D.80609@mysql.com>
  7. Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-readline/2007-01/msg00002.html
  8. Bug-Description:
  9. Readline neglects to reallocate the array it uses to keep track of wrapped
  10. screen lines when increasing its size. This will eventually result in
  11. segmentation faults when given sufficiently long input.
  12. Patch:
  13. *** ../readline-5.2-patched/display.c Thu Sep 14 14:20:12 2006
  14. --- ./display.c Fri Feb 2 20:23:17 2007
  15. ***************
  16. *** 561,574 ****
  17. --- 561,586 ----
  18. wrap_offset = prompt_invis_chars_first_line = 0;
  19. }
  20. + #if defined (HANDLE_MULTIBYTE)
  21. #define CHECK_INV_LBREAKS() \
  22. do { \
  23. if (newlines >= (inv_lbsize - 2)) \
  24. { \
  25. inv_lbsize *= 2; \
  26. inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
  27. + _rl_wrapped_line = (int *)xrealloc (_rl_wrapped_line, inv_lbsize * sizeof (int)); \
  28. } \
  29. } while (0)
  30. + #else
  31. + #define CHECK_INV_LBREAKS() \
  32. + do { \
  33. + if (newlines >= (inv_lbsize - 2)) \
  34. + { \
  35. + inv_lbsize *= 2; \
  36. + inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
  37. + } \
  38. + } while (0)
  39. + #endif /* HANDLE_MULTIBYTE */
  40. #if defined (HANDLE_MULTIBYTE)
  41. #define CHECK_LPOS() \