public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug locale/19012] New: iconv_open leaks memory on error path
@ 2015-09-27 19:14 ppluzhnikov at google dot com
  2015-09-27 19:16 ` [Bug locale/19012] " ppluzhnikov at google dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ppluzhnikov at google dot com @ 2015-09-27 19:14 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=19012

            Bug ID: 19012
           Summary: iconv_open leaks memory on error path
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: locale
          Assignee: unassigned at sourceware dot org
          Reporter: ppluzhnikov at google dot com
  Target Milestone: ---

Google ref: b/2800961

Test case:

#include <iconv.h>

int main() {
  iconv_t res = iconv_open("UTF8", "SJIS");
  if (res == (iconv_t) -1) return 1;
  iconv_close(res);
  return 0;
}

If glibc is built normally, but iconvdata/SJIS.so is *not* installed on the
target (e.g. to save space), then above program shows a memory leak:

==19518== HEAP SUMMARY:
==19518==     in use at exit: 23 bytes in 2 blocks
==19518==   total heap usage: 2,357 allocs, 2,355 frees, 159,395 bytes
allocated
==19518==
==19518== 7 bytes in 1 blocks are definitely lost in loss record 1 of 2
==19518==    at 0x4A06C3D: malloc (vg_replace_malloc.c:299)
==19518==    by 0x4C94BD9: strdup (strdup.c:42)
==19518==    by 0x4C35FB3: gen_steps (gconv_db.c:264)
==19518==    by 0x4C35FB3: find_derivation (gconv_db.c:663)
==19518==    by 0x4C366EC: __gconv_find_transform (gconv_db.c:764)
==19518==    by 0x4C35224: __gconv_open (gconv_open.c:110)
==19518==    by 0x4C34DD0: iconv_open (iconv_open.c:71)
==19518==    by 0x4006BC: main (t.c:4)
==19518==
==19518== 16 bytes in 1 blocks are definitely lost in loss record 2 of 2
==19518==    at 0x4A06C3D: malloc (vg_replace_malloc.c:299)
==19518==    by 0x4C94BD9: strdup (strdup.c:42)
==19518==    by 0x4C35FC5: gen_steps (gconv_db.c:267)
==19518==    by 0x4C35FC5: find_derivation (gconv_db.c:663)
==19518==    by 0x4C366EC: __gconv_find_transform (gconv_db.c:764)
==19518==    by 0x4C35224: __gconv_open (gconv_open.c:110)
==19518==    by 0x4C34DD0: iconv_open (iconv_open.c:71)
==19518==    by 0x4006BC: main (t.c:4)
==19518==
==19518== LEAK SUMMARY:
==19518==    definitely lost: 23 bytes in 2 blocks


This bug has been present in glibc since at least 2.11.1, but likely much
longer.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug locale/19012] iconv_open leaks memory on error path
  2015-09-27 19:14 [Bug locale/19012] New: iconv_open leaks memory on error path ppluzhnikov at google dot com
@ 2015-09-27 19:16 ` ppluzhnikov at google dot com
  2015-10-01 12:27 ` fweimer at redhat dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ppluzhnikov at google dot com @ 2015-09-27 19:16 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=19012

Paul Pluzhnikov <ppluzhnikov at google dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |ppluzhnikov at google dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug locale/19012] iconv_open leaks memory on error path
  2015-09-27 19:14 [Bug locale/19012] New: iconv_open leaks memory on error path ppluzhnikov at google dot com
  2015-09-27 19:16 ` [Bug locale/19012] " ppluzhnikov at google dot com
@ 2015-10-01 12:27 ` fweimer at redhat dot com
  2015-10-03 18:24 ` fweimer at redhat dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: fweimer at redhat dot com @ 2015-10-01 12:27 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=19012

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com
              Flags|                            |security?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug locale/19012] iconv_open leaks memory on error path
  2015-09-27 19:14 [Bug locale/19012] New: iconv_open leaks memory on error path ppluzhnikov at google dot com
  2015-09-27 19:16 ` [Bug locale/19012] " ppluzhnikov at google dot com
  2015-10-01 12:27 ` fweimer at redhat dot com
@ 2015-10-03 18:24 ` fweimer at redhat dot com
  2015-10-06  3:06 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: fweimer at redhat dot com @ 2015-10-03 18:24 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=19012

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|security?                   |security-

--- Comment #1 from Florian Weimer <fweimer at redhat dot com> ---
Per <https://sourceware.org/ml/libc-alpha/2015-10/msg00054.html>, this is not
an unbounded memory leak, so no security impact.  (It is still a bug.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug locale/19012] iconv_open leaks memory on error path
  2015-09-27 19:14 [Bug locale/19012] New: iconv_open leaks memory on error path ppluzhnikov at google dot com
                   ` (2 preceding siblings ...)
  2015-10-03 18:24 ` fweimer at redhat dot com
@ 2015-10-06  3:06 ` cvs-commit at gcc dot gnu.org
  2015-10-06  3:06 ` ppluzhnikov at google dot com
  2015-10-29 17:09 ` jsm28 at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2015-10-06  3:06 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=19012

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  be64c2ef2ac2357ddff61841f2cc8246e5da1b20 (commit)
      from  cec7d28af8ccb40dbf82d99efa13a040b31b9387 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=be64c2ef2ac2357ddff61841f2cc8246e5da1b20

commit be64c2ef2ac2357ddff61841f2cc8246e5da1b20
Author: Paul Pluzhnikov <ppluzhnikov@google.com>
Date:   Mon Oct 5 20:03:48 2015 -0700

    Fix BZ #19012 -- iconv_open leaks memory on error path.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog        |    6 ++++++
 NEWS             |    4 ++--
 iconv/gconv_db.c |   39 +++++++++++++++++++++++++++++++--------
 3 files changed, 39 insertions(+), 10 deletions(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug locale/19012] iconv_open leaks memory on error path
  2015-09-27 19:14 [Bug locale/19012] New: iconv_open leaks memory on error path ppluzhnikov at google dot com
                   ` (3 preceding siblings ...)
  2015-10-06  3:06 ` cvs-commit at gcc dot gnu.org
@ 2015-10-06  3:06 ` ppluzhnikov at google dot com
  2015-10-29 17:09 ` jsm28 at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: ppluzhnikov at google dot com @ 2015-10-06  3:06 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=19012

Paul Pluzhnikov <ppluzhnikov at google dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Paul Pluzhnikov <ppluzhnikov at google dot com> ---
Fixed on trunk.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug locale/19012] iconv_open leaks memory on error path
  2015-09-27 19:14 [Bug locale/19012] New: iconv_open leaks memory on error path ppluzhnikov at google dot com
                   ` (4 preceding siblings ...)
  2015-10-06  3:06 ` ppluzhnikov at google dot com
@ 2015-10-29 17:09 ` jsm28 at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2015-10-29 17:09 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=19012

Joseph Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |2.23

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-10-29 17:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-27 19:14 [Bug locale/19012] New: iconv_open leaks memory on error path ppluzhnikov at google dot com
2015-09-27 19:16 ` [Bug locale/19012] " ppluzhnikov at google dot com
2015-10-01 12:27 ` fweimer at redhat dot com
2015-10-03 18:24 ` fweimer at redhat dot com
2015-10-06  3:06 ` cvs-commit at gcc dot gnu.org
2015-10-06  3:06 ` ppluzhnikov at google dot com
2015-10-29 17:09 ` jsm28 at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).