Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Recursion or loop, design questions Date: Fri, 10 Jul 2015 13:30:43 -0700 Organization: None to speak of Lines: 28 Message-ID: References: <60a17017-4fa3-4367-8b88-02038deb499e@googlegroups.com> <559FEA49.9020007@verizon.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="3653"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX195Unh5wca3khhicXUqODc/" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:VgIcEdPJvBd92ihLQkR6kaYRCsA= sha1:513YZ/mQ55rWaMhu2ADWrs3Kac0= Xref: csiph.com comp.lang.c:65184 ram@zedat.fu-berlin.de (Stefan Ram) writes: > Keith Thompson writes: >>Are there practical cases where a stack *overflow* can cause problems >>other than terminating the program? > > »stack overflow does not necessarily have to result > in a crash with a nice error message, but might also > overwrite non-stack parts of the memory (possibly > putting the address of virus code there)« > > n1637 n1637, http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1637.pdf, is titled "Subtleties of the ANSI/ISO C standard". I'm aware that the the behavior of stack overflow is not defined by the C standard. That passage suggests that it can behave in ways other than terminating the program, but it offers no concrete examples. My question is, how likely is it *in practice* for a stack overflow to fail to be detected, and to result in something other than program termination? -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"