Skip to content

Unpredictable behavior in a specific case of unused decimal point pins caused by an array out of bounds condition #109

@6v6gt-duino

Description

@6v6gt-duino

Unpredictable behavior occurs if only seven segments pins (that is no decimal point pins) are defined in the array segmentPins[] in the call to the begin() method but the parameter disableDecPoint is omitted.

This could be the case when the decimal point pins of the seven segment displays are not used.

The problem is that the default value of disableDecPoint is false. This leads to the library treating the number of elements in segmentPins[] as 8 even though only 7 elements are present. When the array is later scanned an attempt is made to read the non-existent element number 8 leading to this unpredictable behavior [array out of bounds].

In the specific case recorded at https://forum.arduino.cc/t/2-digit-display-with-sevseg-library-a-segment-staying-on/1230896 the effect of this error was that an unwanted segment on a display remained lit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions