From owner-freebsd-bugs@FreeBSD.ORG Sat Dec 13 00:07:04 2014 Return-Path: Delivered-To: freebsd-bugs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9C4D1C39 for ; Sat, 13 Dec 2014 00:07:04 +0000 (UTC) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 839077B5 for ; Sat, 13 Dec 2014 00:07:04 +0000 (UTC) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.14.9/8.14.9) with ESMTP id sBD074nP037281 for ; Sat, 13 Dec 2014 00:07:04 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 195929] usr.bin/sed -- eliminate one malloc and add consts Date: Sat, 13 Dec 2014 00:07:04 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 10.1-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: mi@ALDAN.algebra.com X-Bugzilla-Status: New X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.isobsolete attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2014 00:07:04 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195929 Mikhail T. changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #150516|0 |1 is obsolete| | --- Comment #2 from Mikhail T. --- Created attachment 150518 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=150518&action=edit Constify, remove command-length limits This patch purports to eliminate the use of static buffers (of size _POSIX2_LINE_MAX -- 2048). They are replaced by either dynamically-allocated memory (when reading from file using getline() instead fgets()) and by using the already-recorded strings, when those are given on command-line (-e). This saves run-time memory -- because most commands are much shorter than 2048, while also lifting the hard-limit for those cases, when a command is longer... The latter case was handled badly before -- the command was silently truncated leading to cryptic error messages at best (see Bug 177018) or to a possible corruption at worst. Tested (under valgrind) against math.sed and hanoi.sed, as well as the very long -e argument. -- You are receiving this mail because: You are the assignee for the bug.