-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
The PID::PID() constructor prematurely accesses uninitialized members, which can potentially dereference an uninitialized pointer (this causes a Segmentation Fault when testing locally on my Linux box.)
PID::PID(double* Input, double* Output, double* Setpoint,
double Kp, double Ki, double Kd, int ControllerDirection)
{
PID::SetOutputLimits(0, 255); //default output limit corresponds to
The SetOutputLimits() method depends on members "inAuto" "myOutput" and "ITerm", which have not yet been initialized by the time it is called by the constructor. If "inAuto" (uninitialized) happens to be true, SetOutputLimits() will read+write to a random memory location via the uninitialized pointer "myOutput".
The call to PID::SetControllerDirection() also prematurely accesses uninitialized members, but that appears to be harmless.
Metadata
Metadata
Assignees
Labels
No labels