about summary refs log tree commit diff
path: root/time
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2020-03-19 18:32:28 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-03-20 11:02:38 -0300
commit3cc4a8367c23582b7db14cf4e150e4068b7fd461 (patch)
tree15d2a2d398477b12d4f808a4412ef1ca1fa52a0b /time
parent39a05214fe14ff722d4d92e697fb71ff15e84e70 (diff)
downloadglibc-3cc4a8367c23582b7db14cf4e150e4068b7fd461.tar.gz
glibc-3cc4a8367c23582b7db14cf4e150e4068b7fd461.tar.xz
glibc-3cc4a8367c23582b7db14cf4e150e4068b7fd461.zip
stdio: Remove memory leak from multibyte convertion [BZ#25691]
This is an updated version of a previous patch [1] with the
following changes:

  - Use compiler overflow builtins on done_add_func function.
  - Define the scratch +utstring_converted_wide_string using
    CHAR_T.
  - Added a testcase and mention the bug report.

Both default and wide printf functions might leak memory when
manipulate multibyte characters conversion depending of the size
of the input (whether __libc_use_alloca trigger or not the fallback
heap allocation).

This patch fixes it by removing the extra memory allocation on
string formatting with conversion parts.

The testcase uses input argument size that trigger memory leaks
on unpatched code (using a scratch buffer the threashold to use
heap allocation is lower).

Checked on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

[1] https://sourceware.org/pipermail/libc-alpha/2017-June/082098.html
Diffstat (limited to 'time')
0 files changed, 0 insertions, 0 deletions