[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: stack smashing detected

From: metachromatic
Subject: Re: stack smashing detected
Date: Thu, 25 Apr 2019 15:55:14 -0700

  Stack-smashing is triggered by code inside the gcc compiler that's
designed to detect and avoid buffer overflows. What's happening
(probably) is that you're popping more values off the stack than you
pushed on and threatening to read into an illegal memory location just
beyond the pointer to which the bottom of the stack points.

  If you disable the protection variables in the gcc compiler that are
designed to serve as extra buffers on the stack by using
-fno-stack-protection, you'll get more information but also probably a
segfault and full crash. The segfault will occur due to the compiler
trying to read beyond the bottom of the stack into an illegal memory
location and the kernel calling a full halt due to the illegal

  The underlying reason for this error is probably that you're trying
to use too many points in the slur, which I would guess is handled by
pushing values onto and popping values off the stack that controls the
slur. This most likely results from trying to use a high-order
polynomial for the slur.

  There's no need to use a higher-order polynomial for the slur,
especially since this produce's Runge's Phenomenon, in which the slur
(polynomial curve) wiggles increasingly badly in between the control
points as the order of the polynomial rises.

  A cubic spline should prove entirely adequate regardless of the
number of control points. A cubic spline avoids Runge's Phenomenon and
also yields a curve guaranteed to exhibit a smooth first and second
derivative, which is pretty much all you need. (Why would you need a
discontinuous 5th derivative, for example, in your slur?)

  Reducing the degree of the polynomial _should_ eliminate the
stack-smashing error. Guessing that the size of the stack used in the
slur is matched to the degree of the polynomial, and going to higher
order polynomials without changing the stack size produces the error.

  2nd or 3rd order spline polynomials should be perfectly adequate for
any reasonable slur it's possible to imagine. If you need sharp
discontinuous jumps during the slur, this can better be achieved by
ending the previous note and starting a new note with a new slur.
A discontinuity in the slur where the derivative becomes undefined is
the only reason I can imagine why you'd need a higher-order polynomial
for the spline that defines the slur.

  Remember that the number of control points is entirely unrelated to
the degree of the cubic spline. You can have 100 control points but
you will still only need a third degree polynomial for the cubic

reply via email to

[Prev in Thread] Current Thread [Next in Thread]