[Bug 2002006] [NEW] stdio: memory leak in multibyte printf

Simon Chopin 2002006 at bugs.launchpad.net
Thu Jan 5 15:56:54 UTC 2023


Public bug reported:

[Impact]
There's a memory leak when using printf for multibyte characters.

[Test case]

> test-printf.c cat <<EOF
#include <stdio.h>

int main()
{
    int i;
    for (i = 0; i < (1 << 16); ++i) printf("%.1371337ls", L"A\n");
    return 0;
}
EOF
gcc -o test-printf test-printf.c
/usr/bin/time -f '%M' ./test-printf > /dev/null

With the fix I get a 1544k footprint, without it 263232k.

[Regression potential]
The stdio subsystem is a fairly complex one and the patch isn't trivial, so we could introduce new bugs, especially in non-ASCII environments.

** Affects: glibc (Ubuntu)
     Importance: Medium
         Status: Fix Released

** Affects: glibc (Ubuntu Focal)
     Importance: Medium
     Assignee: Simon Chopin (schopin)
         Status: In Progress

** Also affects: glibc (Ubuntu Focal)
   Importance: Undecided
       Status: New

** Changed in: glibc (Ubuntu)
       Status: New => Fix Released

** Changed in: glibc (Ubuntu Focal)
   Importance: Undecided => Medium

** Changed in: glibc (Ubuntu Focal)
       Status: New => In Progress

** Changed in: glibc (Ubuntu Focal)
     Assignee: (unassigned) => Simon Chopin (schopin)

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to glibc in Ubuntu.
https://bugs.launchpad.net/bugs/2002006

Title:
  stdio: memory leak in multibyte printf

Status in glibc package in Ubuntu:
  Fix Released
Status in glibc source package in Focal:
  In Progress

Bug description:
  [Impact]
  There's a memory leak when using printf for multibyte characters.

  [Test case]

  > test-printf.c cat <<EOF
  #include <stdio.h>

  int main()
  {
      int i;
      for (i = 0; i < (1 << 16); ++i) printf("%.1371337ls", L"A\n");
      return 0;
  }
  EOF
  gcc -o test-printf test-printf.c
  /usr/bin/time -f '%M' ./test-printf > /dev/null

  With the fix I get a 1544k footprint, without it 263232k.

  [Regression potential]
  The stdio subsystem is a fairly complex one and the patch isn't trivial, so we could introduce new bugs, especially in non-ASCII environments.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/2002006/+subscriptions




More information about the foundations-bugs mailing list