Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Dec 2014 00:07:04 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 195929] usr.bin/sed -- eliminate one malloc and add consts
Message-ID:  <bug-195929-8-TDn7yhjiCa@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-195929-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-195929-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195929

Mikhail T. <mi@ALDAN.algebra.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #150516|0                           |1
        is obsolete|                            |

--- Comment #2 from Mikhail T. <mi@ALDAN.algebra.com> ---
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-195929-8-TDn7yhjiCa>