* [PATCH,AIX] Don't leak a file descriptor if an archive is malformed.
[not found] <B37989F2852398498001550C29155BE5178A6D40@FRCRPVV9EX3MSX.ww931.my-it-solutions.net>
@ 2017-07-27 15:06 ` REIX, Tony
2017-07-27 15:31 ` REIX, Tony
1 sibling, 0 replies; 3+ messages in thread
From: REIX, Tony @ 2017-07-27 15:06 UTC (permalink / raw)
To: gcc-patches; +Cc: Ian Lance Taylor, dje.gcc
(Damned ! Brut text format required !!)
Description:
* This patch fixes a possible leak of a file descriptor if an archive is malformed.
Tests:
* Fedora25/x86_64 + GCC trunk : SUCCESS
- gmake in libbacktrace directory
* AIX :
- gmake in libbacktrace directory
ChangeLog:
* xcoff.c: Don't leak a file descriptor if an archive is malformed.
Cordialement,
Tony Reix
Bull - ATOS
IBM Coop Architect & Technical Leader
Office : +33 (0) 4 76 29 72 67
1 rue de Provence - 38432 Échirolles - France
www.atos.net
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE:[PATCH,AIX] Don't leak a file descriptor if an archive is malformed.
[not found] <B37989F2852398498001550C29155BE5178A6D40@FRCRPVV9EX3MSX.ww931.my-it-solutions.net>
2017-07-27 15:06 ` [PATCH,AIX] Don't leak a file descriptor if an archive is malformed REIX, Tony
@ 2017-07-27 15:31 ` REIX, Tony
2017-07-28 18:52 ` [PATCH,AIX] " Ian Lance Taylor
1 sibling, 1 reply; 3+ messages in thread
From: REIX, Tony @ 2017-07-27 15:31 UTC (permalink / raw)
To: gcc-patches; +Cc: Ian Lance Taylor, dje.gcc
[-- Attachment #1: Type: text/plain, Size: 156 bytes --]
Better with the patch file...
Sorry. The Resend did not add the joint file I added with first message (in HTML format, refused).
Hope it's OK now.
Tony
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gcc-8.0.0-libbacktrace-filedescriptorleak.patch --]
[-- Type: text/x-patch; name="gcc-8.0.0-libbacktrace-filedescriptorleak.patch", Size: 1928 bytes --]
Index: libbacktrace/ChangeLog
===================================================================
--- libbacktrace/ChangeLog (revision 250609)
+++ libbacktrace/ChangeLog (working copy)
@@ -1,3 +1,7 @@
+2017-07-27 Tony Reix <tony.reix@atos.net>
+
+ * xcoff.c: Don't leak a file descriptor if an archive is malformed.
+
2017-07-26 Tony Reix <tony.reix@atos.net>
* configure.ac: Check for XCOFF32/XCOFF64. Check for loadquery.
Index: libbacktrace/xcoff.c
===================================================================
--- libbacktrace/xcoff.c (revision 250609)
+++ libbacktrace/xcoff.c (working copy)
@@ -1288,7 +1288,7 @@ xcoff_armem_add (struct backtrace_state *state, in
if (!backtrace_get_view (state, descriptor, 0, sizeof (b_ar_fl_hdr),
error_callback, data, &view))
- return 0;
+ goto fail;
memcpy (&fl_hdr, view.data, sizeof (b_ar_fl_hdr));
@@ -1295,13 +1295,13 @@ xcoff_armem_add (struct backtrace_state *state, in
backtrace_release_view (state, &view, error_callback, data);
if (memcmp (fl_hdr.fl_magic, AIAMAGBIG, 8) != 0)
- return 0;
+ goto fail;
memlen = strlen (member);
/* Read offset of first archive member. */
if (!xcoff_parse_decimal (fl_hdr.fl_fstmoff, sizeof fl_hdr.fl_fstmoff, &off))
- return 0;
+ goto fail;
while (off != 0)
{
/* Map archive member header and member name. */
@@ -1309,7 +1309,7 @@ xcoff_armem_add (struct backtrace_state *state, in
if (!backtrace_get_view (state, descriptor, off,
sizeof (b_ar_hdr) + memlen,
error_callback, data, &view))
- return 0;
+ break;
ar_hdr = (const b_ar_hdr *) view.data;
@@ -1345,6 +1345,7 @@ xcoff_armem_add (struct backtrace_state *state, in
backtrace_release_view (state, &view, error_callback, data);
}
+ fail:
/* No matching member found. */
backtrace_close (descriptor, error_callback, data);
return 0;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH,AIX] Don't leak a file descriptor if an archive is malformed.
2017-07-27 15:31 ` REIX, Tony
@ 2017-07-28 18:52 ` Ian Lance Taylor
0 siblings, 0 replies; 3+ messages in thread
From: Ian Lance Taylor @ 2017-07-28 18:52 UTC (permalink / raw)
To: REIX, Tony; +Cc: gcc-patches, dje.gcc
On Thu, Jul 27, 2017 at 8:31 AM, REIX, Tony <tony.reix@atos.net> wrote:
> Better with the patch file...
> Sorry. The Resend did not add the joint file I added with first message (in HTML format, refused).
> Hope it's OK now.
Thanks. Committed to mainline.
Ian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-07-28 18:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <B37989F2852398498001550C29155BE5178A6D40@FRCRPVV9EX3MSX.ww931.my-it-solutions.net>
2017-07-27 15:06 ` [PATCH,AIX] Don't leak a file descriptor if an archive is malformed REIX, Tony
2017-07-27 15:31 ` REIX, Tony
2017-07-28 18:52 ` [PATCH,AIX] " Ian Lance Taylor
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).