Re: [hackers] [sbase] [patch] ed: standards compliance, manpage, double free and infinite loop fix

From: Thomas Mannay <audiobarrier_AT_openmailbox.org>
Date: Sun, 9 Oct 2016 21:40:55 +0000

Thank you for the feedback.

> - change the name to "ed: place newly-joined lines correctly"
Will bear in mind for future patches that I should use more active descriptions.
> - the code within join() is not tab- but space-indented
And here I thought I had set my editor to indent tabs...
> - can getindex(curln-1) underflow? (if curln = 0)
iirc currln can't be 0 since addresses start at 1 in ed. I've experienced no
issues with joining a set of addresses beginning with the first line.
> - what's the purpose of the free(s)?
The original code had two frees, which I assume was due to a static char pointer.
This would cause a double free if you did two join commands in a row. The free at
the end of the function is required because addchar returns a manually allocated
char pointer.
> - can you give an example in the patch-description where this
> infinite loop occurs?
I'm unsure where the patch description would be, but it occurs when you issue
1,2j when there are only two lines in the buffer. Doing that on the unpatched ed
causes it to stop accepting commands until given an interrupt due to an infinite
loop.
> - Do we really need an "EXTENDED DESCRIPTION"
Yes, it's one of the standard manpage subheadings and allowed me to properly
document ed. It felt like The Right Thing since correct documentation is as
important as correct code. It's actually how I found the bugs I fixed. :^)
> - Please check the other manpages for the standard format of
> the STANDARDS section
Have amended this with the attached patch.

Should I redo those patches to account for changing commit messages to more
active forms?

Thank you,
Thomas

--
Thomas Mannay <audiobarrier_AT_openmailbox.org>
Received on Sun Oct 09 2016 - 23:40:55 CEST

This archive was generated by hypermail 2.3.0 : Sun Oct 09 2016 - 23:48:15 CEST