Skip to content

fix(pixels): initialise all members of strands array#927

Open
tyeth wants to merge 4 commits into
mainfrom
tyeth/issue926
Open

fix(pixels): initialise all members of strands array#927
tyeth wants to merge 4 commits into
mainfrom
tyeth/issue926

Conversation

@tyeth
Copy link
Copy Markdown
Member

@tyeth tyeth commented Jun 5, 2026

Fixes #926

Previously the strands array was only initialising the first member with the supplied initialiser (and the remainder zero initialised rather than using the supplied values):

strand_s strands[MAX_PIXEL_STRANDS]{
    nullptr,
    nullptr,
    wippersnapper_pixels_v1_PixelsType_PIXELS_TYPE_UNSPECIFIED,
    0,
    0,
    wippersnapper_pixels_v1_PixelsOrder_PIXELS_ORDER_UNSPECIFIED,
    -1,
    -1,
    -1};

This meant the safety check of getStrandIndex(atoi(pin)) did a check on the first element and was fine, but would presumably crash because the pins being checked were not -1 when iterating over further strands array elements, allowing the write to proceed on an unsetup PWM channel.

Change is to do the default intialising of all members in a new constructor.

@tyeth tyeth marked this pull request as ready for review June 5, 2026 20:36
@tyeth tyeth requested a review from brentru June 5, 2026 20:50
@tyeth
Copy link
Copy Markdown
Member Author

tyeth commented Jun 5, 2026

I'll test with protomq against v1 protos and send a write without an add. Should crash on released firmware and not on this.

@tyeth tyeth removed the request for review from brentru June 5, 2026 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setting value on DotStar causes crash

1 participant