This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch for run-1.3.0-1 core dump


On 2/18/2014 4:16 AM, Corinna Vinschen wrote:
On Feb 17 17:25, Jon TURNEY wrote:
...
I went to all the trouble of investigating this, discovering that
run2_freeargv() is double-freeing the last element in newargv because the NULL
terminator isn't moved when the arguments are shifted down over newargv[0],
and writing a patch, before I noticed that we already had one :-(

--- origsrc/run-1.3.0/src/run.c 2013-07-24 16:26:39.000000000 +0100
+++ src/run-1.3.0/src/run.c     2014-02-17 17:08:49.125000000 +0000
@@ -254,6 +254,7 @@ realMain(int argc, char* argv[])
        free (newargv[0]);
        for (newargc = 1; newargc < argc; newargc++)
           newargv[newargc-1] = newargv[newargc];
+      newargv[argc-1] = 0;
        newargc = argc - 1;

        /* update execname */
There's still something wrong.  I build run with this patch locally,
and it seems to fix the issue at first sight.  However, after the
child process of run exits, run throws an exception in free(), and
the stack looks broken (on 64 bit).  It seems there is a double free
or a free of an entirely unrelated address.
Scratch that.  I managed to fat-finger a one-line patch.  Sorry.

Corinna

Did my earlier patch get included?  I haven't seen a "run" new version yet.

http://www.cygwin.com/ml/cygwin/2013-12/msg00006.html

My patch was the one that properly quote arguments. Maybe let's start with that before putting new stuff underneath it. From Chuck: "I'll roll a new update fairly soon."

http://www.cygwin.com/ml/cygwin/2013-12/msg00045.html


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]