Date: Tue, 19 Feb 2013 23:46:51 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247013 - head/bin/sh Message-ID: <201302192346.r1JNkpnP036039@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Tue Feb 19 23:46:51 2013 New Revision: 247013 URL: http://svnweb.freebsd.org/changeset/base/247013 Log: sh: Fix a crash with the stackmark code. If a stack mark is set while the current stack block is empty, the stack block may move later on (because of realloc()) and the stack mark needs to be updated. This updating does not happen after popstackmark() has been called; therefore, call setstackmark() again if the stack mark is still being used. For some reason, this only affects a few users. I cannot reproduce it. The situation seems quite rare as well because an empty stack block would usually be freed (by popstackmark()) before execution reaches a setstackmark() call. PR: 175922 Tested by: KT Sin Modified: head/bin/sh/eval.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Tue Feb 19 21:35:17 2013 (r247012) +++ head/bin/sh/eval.c Tue Feb 19 23:46:51 2013 (r247013) @@ -174,6 +174,7 @@ evalstring(char *s, int flags) any = 1; } popstackmark(&smark); + setstackmark(&smark); } popfile(); popstackmark(&smark); @@ -296,6 +297,7 @@ evaltree(union node *n, int flags) } n = next; popstackmark(&smark); + setstackmark(&smark); } while (n != NULL); out: popstackmark(&smark);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201302192346.r1JNkpnP036039>