Re: [hackers] [sbase] Revert "ed: remove double free in join()" ||

2017-01-24 Thread Roberto E . Vargas Caballero
Hello Thomas,

Sorry for the delay, I had some problems with my mail lately,


> The trouble with reverting my commit is that readding the double free 
> completely
> crashes ed if more than one join is performed. I think this patch (which also 
> reverts
> back to having no double free) should handle your concern via blocking signal 
> handling
> until the join is finished.

Ok, I understand.  Mixing longjmp signals and dynamic memory was a
really bad idea.  Your idea is not bad, but I think we should block
sigprocmask and related functions, instead of playing with variables.

Regards,




Re: [hackers] [sbase] Revert "ed: remove double free in join()" || Roberto E. Vargas Caballero

2017-01-10 Thread Thomas Mannay
Hello Roberto,

The trouble with reverting my commit is that readding the double free completely
crashes ed if more than one join is performed. I think this patch (which also 
reverts
back to having no double free) should handle your concern via blocking signal 
handling
until the join is finished.

Thomas

--
Thomas Mannay 


0001-ed-ignore-signals-inside-of-join.patch
Description: Binary data


[hackers] [sbase] Revert "ed: remove double free in join()" || Roberto E. Vargas Caballero

2017-01-09 Thread git
commit 78bfd8978ea2af10dadc3fdadd19710068a632c4
Author: Roberto E. Vargas Caballero 
AuthorDate: Tue Jan 10 08:41:35 2017 +0100
Commit: Roberto E. Vargas Caballero 
CommitDate: Tue Jan 10 08:41:35 2017 +0100

Revert "ed: remove double free in join()"

This reverts commit 30da327fbd27eee508c5492a763ea19d7cd9e281.
The double free is needed to avoid memory leaks when signals are caught

diff --git a/ed.c b/ed.c
index 52b2684..f579116 100644
--- a/ed.c
+++ b/ed.c
@@ -813,8 +813,9 @@ join(void)
int i;
char *t, c;
size_t len = 0, cap = 0;
-   char *s;
+   static char *s;
 
+   free(s);
for (s = NULL, i = line1;; i = nextln(i)) {
for (t = gettxt(i); (c = *t) != '\n'; ++t)
s = addchar(*t, s, , );