Skip to content

Validate frequency arg for ParallelBus to prevent crash on 0 - #11041

Merged
tannewt merged 1 commit into
adafruit:mainfrom
dhalbert:parallelbus-freq-validation
Jun 2, 2026
Merged

tannewt merged 1 commit into
adafruit:mainfrom
dhalbert:parallelbus-freq-validation

Conversation

@dhalbert

@dhalbert dhalbert commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

ParallelBus was not validating the frequency arg. If it was 0, there was an internal error in ESP-IDF (probably a divide by zero), which caused a hard crash. Require frequency to be >= 1.

Tested on a UM ProS3 with the original test code.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds input validation to the paralleldisplaybus.ParallelBus Python constructor to prevent a hard crash on ESP32-S3 when frequency=0 is passed, by requiring frequency >= 1.

Changes:

  • Validate frequency using mp_arg_validate_int_min(..., 1, ...) in ParallelBus.__init__.
  • Pass the validated frequency value through to both sequential (data0) and non-sequential (data_pins) constructor paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread shared-bindings/paralleldisplaybus/ParallelBus.c Outdated
@dhalbert
dhalbert force-pushed the parallelbus-freq-validation branch from 083c458 to d90f4f3 Compare June 2, 2026 00:20
@dhalbert

dhalbert commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator Author

I didn't mean to ask Copilot for a review. That was a mouse-click error. But I did the cast anyway.

@tannewt tannewt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@tannewt
tannewt merged commit 99cdea4 into adafruit:main Jun 2, 2026
471 checks passed
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.

Hard Fault using ParallelBus on ESP32-S3

3 participants