Commit 9a0b8eb1 authored by unknown's avatar unknown

Bug#19474 readline bug: mysql: free(): invalid pointer

 - Write to uninitialised memory occured since _rl_rapped_lines buffer
   was not extended in CHECK_INV_LBREAKS macro
 - Patch submitted to bug-readline@gnu.org


cmd-line-utils/readline/display.c:
  Extend _rl_wrapped_lines everytime inv_lbsize is increased
parent 7d4477f8
...@@ -524,6 +524,17 @@ rl_redisplay () ...@@ -524,6 +524,17 @@ rl_redisplay ()
wrap_offset = prompt_invis_chars_first_line = 0; wrap_offset = prompt_invis_chars_first_line = 0;
} }
#if defined (HANDLE_MULTIBYTE)
#define CHECK_INV_LBREAKS() \
do { \
if (newlines >= (inv_lbsize - 2)) \
{ \
inv_lbsize *= 2; \
inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
_rl_wrapped_line = (int *)xrealloc (_rl_wrapped_line, inv_lbsize * sizeof (int)); \
} \
} while (0)
#else
#define CHECK_INV_LBREAKS() \ #define CHECK_INV_LBREAKS() \
do { \ do { \
if (newlines >= (inv_lbsize - 2)) \ if (newlines >= (inv_lbsize - 2)) \
...@@ -532,6 +543,7 @@ rl_redisplay () ...@@ -532,6 +543,7 @@ rl_redisplay ()
inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \ inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
} \ } \
} while (0) } while (0)
#endif
#if defined (HANDLE_MULTIBYTE) #if defined (HANDLE_MULTIBYTE)
#define CHECK_LPOS() \ #define CHECK_LPOS() \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment