From unknown Wed Jun 18 00:24:29 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#15472 <15472@debbugs.gnu.org> To: bug#15472 <15472@debbugs.gnu.org> Subject: Status: segmentation fault if input line is too long Reply-To: bug#15472 <15472@debbugs.gnu.org> Date: Wed, 18 Jun 2025 07:24:29 +0000 retitle 15472 segmentation fault if input line is too long reassign 15472 grep submitter 15472 Holger Then severity 15472 normal tag 15472 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 27 02:27:34 2013 Received: (at submit) by debbugs.gnu.org; 27 Sep 2013 06:27:34 +0000 Received: from localhost ([127.0.0.1]:39595 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VPRWW-0007Y3-Mh for submit@debbugs.gnu.org; Fri, 27 Sep 2013 02:27:33 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56366) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VPAeF-0005a5-Fk for submit@debbugs.gnu.org; Thu, 26 Sep 2013 08:26:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VPAe7-0001Ug-S5 for submit@debbugs.gnu.org; Thu, 26 Sep 2013 08:26:23 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:47196) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPAe7-0001Ub-P3 for submit@debbugs.gnu.org; Thu, 26 Sep 2013 08:26:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57993) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPAe1-0000cF-5V for bug-grep@gnu.org; Thu, 26 Sep 2013 08:26:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VPAdu-0001R9-Ek for bug-grep@gnu.org; Thu, 26 Sep 2013 08:26:09 -0400 Received: from eu1sys200aog119.obsmtp.com ([207.126.144.147]:34296) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPAdu-0001Pm-6B for bug-grep@gnu.org; Thu, 26 Sep 2013 08:26:02 -0400 Received: from mail-wi0-f181.google.com ([209.85.212.181]) (using TLSv1) by eu1sys200aob119.postini.com ([207.126.147.11]) with SMTP ID DSNKUkQn0q2NVcuUAQAqdly5noh2y0SxqeQg@postini.com; Thu, 26 Sep 2013 12:25:56 UTC Received: by mail-wi0-f181.google.com with SMTP id ex4so1130283wid.2 for ; Thu, 26 Sep 2013 05:25:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:subject:message-id :user-agent:mime-version:content-type; bh=txutVmiL/jf3wXhmtAIT56ArCZ8LMJYmFUZcqMhQCNU=; b=Cj/vaWOErDLSGndqMzHtaVW9AuCtg/kv2oqYK4ic7sn7XmoqgOL40lG8b+TJdurbXj wfop8Hwo8Su/99aE9Yil4ZXskePfH3/tAI8y60RsPxjR7/WBbCJ+iav2+ukYgLwrC1Xs E9oCnuQNbtLFzbSu8SQ96AM1SzFEjE1GQL2K6YSF/PRenqBf4fSsVxoWxXhSUNZqlYcr e4s3nhoxTfyNanmSwdEMvDo0Aqjpp4Sj0/0FtN9BLpSt+ojR+2kyu+WCWrXvZwWXhVEm EuQ3HlFSufrRjPZ7JOS7umCy/dtezwYZC+nA8TAfNBi6J9kAKpr+A9hHEoveOhd5rK5U tSJA== X-Gm-Message-State: ALoCoQnyocJIBX1ShT6fqG5OZzhX1JtZNrtc8nrf860sKR52PdHhred8GRcsQgqYM4y5Xsl9YiDlqiTNWHOAJATcMsUdOx013KbU28Y6QozpTJmMarbcqJZMTgMYqEhEhLd0TvYgDj3mKLqEJeyA57RhCLwv2aaz/Q== X-Received: by 10.180.73.40 with SMTP id i8mr27347847wiv.37.1380198354786; Thu, 26 Sep 2013 05:25:54 -0700 (PDT) X-Received: by 10.180.73.40 with SMTP id i8mr27347846wiv.37.1380198354720; Thu, 26 Sep 2013 05:25:54 -0700 (PDT) Received: from [192.168.1.2] (host-78-145-253-244.as13285.net. [78.145.253.244]) by mx.google.com with ESMTPSA id ed12sm27734093wic.11.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 26 Sep 2013 05:25:54 -0700 (PDT) Date: Thu, 26 Sep 2013 14:21:54 +0200 (CEST) From: Holger Then X-X-Sender: then@cygnus.maths.bris.ac.uk To: bug-grep@gnu.org Subject: segmentation fault if input line is too long Message-ID: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Fri, 27 Sep 2013 02:27:13 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) If grep searches through a line that is longer than INT_MAX (= 2147483647) characters, then grep causes a segmentation fault. Interestingly this bug does not occur with fgrep or with grep -F Kind regards, Holger $ wc grep_bug.txt 1 12200610 3281667946 grep_bug.txt $ fgrep -e 1 grep_bug.txt | wc 1 12200610 3281667946 $ grep -Fe 1 grep_bug.txt | wc 1 12200610 3281667946 $ grep -e 1 grep_bug.txt | wc 0 0 0 $ grep -e 1 grep_bug.txt Segmentation fault $ tail -c 2147483647 grep_bug.txt | grep -e 1 | wc 1 8385663 2147483647 $ tail -c 2147483648 grep_bug.txt | grep -e 1 | wc 0 0 0 $ tail -c 2147483648 grep_bug.txt | grep -e 1 Segmentation fault $ uname -a Linux c-0-0.local 2.6.32-358.11.1.el6.x86_64 #1 SMP Wed Jun 12 03:34:52 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux $ grep --version GNU grep 2.6.3 Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 29 00:14:33 2013 Received: (at 15472) by debbugs.gnu.org; 29 Sep 2013 04:14:33 +0000 Received: from localhost ([127.0.0.1]:44216 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VQ8Ov-00080G-5F for submit@debbugs.gnu.org; Sun, 29 Sep 2013 00:14:33 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:58373) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VQ8Ot-000808-H8 for 15472@debbugs.gnu.org; Sun, 29 Sep 2013 00:14:32 -0400 Received: by mail-pa0-f48.google.com with SMTP id bj1so4352966pad.7 for <15472@debbugs.gnu.org>; Sat, 28 Sep 2013 21:14:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=6fpmEQGsTx3+RhdyjP0RnQ7ywfTVgmdeDVQxZGhmkws=; b=l5XIwlPnQ4rGbR38GEGER/B4WZ87bZGnWU29so2suHZzTpazL+Pk1pSqR65TYuVpM+ 5AJECjwkVamBq8MCj6TNuj/LMbiT24n1jrdAOLwiHRiZpgk+hA2mciQCszwhdnmjl5ZY 4WEtjOIEf+BfsFrUFA1ZvqkgHKrmsi5LHvXMP/JajS6myerNLzIEywyRt57y9UdZiJ3B FSgcepHQ2RCzorfVagvPtqDgqdphZFuPjVop09v+BJh5U0zxnu2J/Er0f9BCJi09dar7 VOvk7wdd5GsbTba5L1lcCjd+YDFK2DYjPdwSbr15rrKLlLcQ34sS+ibcpmQCZI44XmJu y/bQ== X-Received: by 10.68.255.69 with SMTP id ao5mr16367279pbd.66.1380428070479; Sat, 28 Sep 2013 21:14:30 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.6.66 with HTTP; Sat, 28 Sep 2013 21:14:10 -0700 (PDT) In-Reply-To: References: From: Jim Meyering Date: Sat, 28 Sep 2013 21:14:10 -0700 X-Google-Sender-Auth: U3_kq-cYjYXmKuhToLeRtxcytvk Message-ID: Subject: Re: bug#15472: segmentation fault if input line is too long To: Holger Then Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 15472 Cc: 15472@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Thu, Sep 26, 2013 at 5:21 AM, Holger Then wrote: > If grep searches through a line that is longer than > INT_MAX (= 2147483647) characters, then grep causes ... > $ tail -c 2147483647 grep_bug.txt | grep -e 1 | wc > 1 8385663 2147483647 > $ tail -c 2147483648 grep_bug.txt | grep -e 1 | wc > 0 0 0 > $ tail -c 2147483648 grep_bug.txt | grep -e 1 > Segmentation fault > > $ uname -a > Linux c-0-0.local 2.6.32-358.11.1.el6.x86_64 #1 SMP Wed Jun 12 03:34:52 UTC > 2013 x86_64 x86_64 x86_64 GNU/Linux > $ grep --version > GNU grep 2.6.3 tags 15472 notabug close 15472 thanks Thank you for the report. Your version of grep is rather old. The latest is grep-2.14, and that particular bug was fixed in 2.11 a year and a half ago. Here is the relevant NEWS entry: * Noteworthy changes in release 2.11 (2012-03-02) [stable] ** Bug fixes grep no longer dumps core on lines whose lengths do not fit in 'int'. (e.g., lines longer than 2 GiB on a typical 64-bit host). Instead, grep either works as expected, or reports an error. An error can occur if not enough main memory is available, or if the GNU C library's regular expression functions cannot handle such long lines. [bug present since "the beginning"] From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 14 18:19:48 2013 Received: (at control) by debbugs.gnu.org; 14 Oct 2013 22:19:48 +0000 Received: from localhost ([127.0.0.1]:49449 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VVqUN-0004XW-29 for submit@debbugs.gnu.org; Mon, 14 Oct 2013 18:19:47 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:7094) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VVqT2-0004V8-H7 for control@debbugs.gnu.org; Mon, 14 Oct 2013 18:18:25 -0400 Received: from pps.filterd (m0044012 [127.0.0.1]) by mx0a-00082601.pphosted.com (8.14.5/8.14.5) with SMTP id r9EMGarX002937 for ; Mon, 14 Oct 2013 15:18:23 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : subject : date : message-id : content-type : content-id : content-transfer-encoding : mime-version; s=facebook; bh=aYNMAvEwsyXIJo702hku8zbVmrkhxLx6Gb4LtQhhtsI=; b=e6WjNgYwPgki1oSJS7juU/RxsQzmhAAvbs72oCx4OvN5nW4kvv2S0PqGdHSsObOqez6z P9BIK7pbOuxirIdedOTaDtNwPdj26o7KiR4phEpsa1KrvpQ8onMy+yLQZGtzsMOFxB5V 33KKFPNuAiAIGfH62dqrRNMLnzK95fYhQ+g= Received: from mail.thefacebook.com (prn1-cmdf-dc01-fw1-nat.corp.tfbnw.net [173.252.71.129] (may be forged)) by mx0a-00082601.pphosted.com with ESMTP id 1fgc9r3n8n-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=OK) for ; Mon, 14 Oct 2013 15:18:23 -0700 Received: from PRN-MBX02-4.TheFacebook.com ([169.254.5.66]) by PRN-CHUB07.TheFacebook.com ([fe80::d38:43fc:554e:146a%12]) with mapi id 14.03.0158.001; Mon, 14 Oct 2013 15:18:07 -0700 From: Jim Meyering To: "control@debbugs.gnu.org" Subject: close+notabug Thread-Topic: close+notabug Thread-Index: AQHOyStBVGvJDb0siUupY6PNlFMb6w== Date: Mon, 14 Oct 2013 22:18:06 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [192.168.16.4] Content-Type: text/plain; charset="us-ascii" Content-ID: <4CB09267E32C634F985FDAC895CA574F@fb.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.10.8794, 1.0.431, 0.0.0000 definitions=2013-10-14_04:2013-10-14,2013-10-14,1970-01-01 signatures=0 X-Spam-Score: -0.4 (/) X-Debbugs-Envelope-To: control X-Mailman-Approved-At: Mon, 14 Oct 2013 18:19:45 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.4 (/) tags 15472 notabug close 15472 thanks From unknown Wed Jun 18 00:24:29 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 12 Nov 2013 12:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator