From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 3FFA61F453 for ; Sat, 26 Jan 2019 20:51:24 +0000 (UTC) Received: from localhost ([127.0.0.1]:35503 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnUvD-0003PN-IG for normalperson@yhbt.net; Sat, 26 Jan 2019 15:51:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55322) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnUvA-0003Om-4I for bug-gnulib@gnu.org; Sat, 26 Jan 2019 15:51:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gnUv6-0004kM-JO for bug-gnulib@gnu.org; Sat, 26 Jan 2019 15:51:17 -0500 Received: from mo6-p01-ob.smtp.rzone.de ([2a01:238:20a:202:5301::2]:22522) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gnUuu-0004b5-2L; Sat, 26 Jan 2019 15:51:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1548535857; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=QwY9YV5GpubnGqyLy15Hxr8yex0X38KjL9xezoX5jSM=; b=U49ARJmdov9mJdEaXPM/uy34N3DzgBwI2qR5IOUSwkxJlFjMQK/PaV95xvXP6MF58n D1YLOC2/xDbOvkH/WFKKg7pQXWzxgtmWhDjYf/a8Y6azTd4BDMxc6csg9n+UBKypVxAw cwZZKeVnkD7/vUaZ/avnjMv75PVY2rYNhDn7GebIfAkzlt0O84KV1IbaPjZwUAzQfq2p MJg4hoHrGDcKMf4QxzwKgGdvzvlohhxKSsQIALkZUNLNIRzdymv4TifJqsIWd2dU/odL jDbnENKm5FLWwdoe/6/wHMe0a9+xkX7UN4pYWhGnoEwgP7gDJTaUXNOaU6K84QRX/lQG x7og== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AHjwLuWOGKf2y/s=" X-RZG-CLASS-ID: mo00 Received: from bruno.haible.de by smtp.strato.de (RZmta 44.9 DYNA|AUTH) with ESMTPSA id v0a34ev0QKouoTj (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Sat, 26 Jan 2019 21:50:56 +0100 (CET) From: Bruno Haible To: bug-libunistring@gnu.org, bruno@haible.de Subject: Re: [bug-libunistring] SIGSEGV on malloc() failure Date: Sat, 26 Jan 2019 21:50:56 +0100 Message-ID: <6651999.xhF4iVikG6@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-141-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <7f9bd21c-74b3-30b6-aee6-1296c14ff5ab@gmx.de> References: <7f9bd21c-74b3-30b6-aee6-1296c14ff5ab@gmx.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:238:20a:202:5301::2 X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tim =?ISO-8859-1?Q?R=FChsen?= Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" [CCing bug-gnulib, since the function 'iconveh_open' comes from gnulib.] Tim R=FChsen wrote in : > I just tested random malloc() failures and stumbled upon a SIGSEGV > (details below). >=20 > Program received signal SIGSEGV, Segmentation fault. > 0x00007ffff7dd1f61 in __gconv_close (cd=3D0x0) at gconv_close.c:34 > 34 gconv_close.c: Datei oder Verzeichnis nicht gefunden. > (gdb) bt > #0 0x00007ffff7dd1f61 in __gconv_close (cd=3D0x0) at gconv_close.c:34 > #1 0x00007ffff7dd185f in iconv_close (cd=3D) at > iconv_close.c:35 > #2 0x00007ffff7c3ddc3 in libunistring_iconveh_open () from > /usr/lib/x86_64-linux-gnu/libunistring.so.2 > #3 0x00007ffff7c3dfcd in libunistring_mem_iconveh () from > /usr/lib/x86_64-linux-gnu/libunistring.so.2 Thanks for the report. The stack trace immediately tells me where the problem comes from. This patch should fix it. It has been a long-standing bug (introduced on 2009-08-30). 2019-01-26 Bruno Haible striconveh: Fix use of uninitialized iconv_t. Reported by Tim R=FChsen in . * lib/striconveh.c (iconveh_open): Correct the iconv_close argument. diff --git a/lib/striconveh.c b/lib/striconveh.c index d4cc503..91184be 100644 =2D-- a/lib/striconveh.c +++ b/lib/striconveh.c @@ -73,7 +73,7 @@ iconveh_open (const char *to_codeset, const char *from_co= deset, iconveh_t *cdp) { int saved_errno =3D errno; if (cd !=3D (iconv_t)(-1)) =2D iconv_close (cdp->cd); + iconv_close (cd); errno =3D saved_errno; return -1; }