Skip to content

zephyrCommon: fix issues with invalid pin numbers#392

Merged
pennam merged 1 commit intoarduino:mainfrom
pillo79:pr-fix-invalid-pin-crash
Mar 19, 2026
Merged

zephyrCommon: fix issues with invalid pin numbers#392
pennam merged 1 commit intoarduino:mainfrom
pillo79:pr-fix-invalid-pin-crash

Conversation

@pillo79
Copy link
Copy Markdown

@pillo79 pillo79 commented Mar 13, 2026

Passing -1 to digital I/O functions may happen when libraries do not properly sanitize their inputs, leading to undefined behavior.
This PR adds a check to ensure that the pin number is valid before accessing the arduino_pins array.

@pillo79 pillo79 changed the title qzephyrCommon: fix issues with invalid pin numbers zephyrCommon: fix issues with invalid pin numbers Mar 13, 2026
@pillo79 pillo79 force-pushed the pr-fix-invalid-pin-crash branch from 1c3b9b5 to 929cee6 Compare March 13, 2026 13:55
@pillo79 pillo79 marked this pull request as ready for review March 13, 2026 14:58
@KurtE
Copy link
Copy Markdown

KurtE commented Mar 13, 2026

Keeping fingers crossed that this makes it in! Tried to do something similar for UNO R4 back in 2023, which is still sitting there.

arduino/ArduinoCore-renesas#95

Passing -1 to digital I/O functions may happen when libraries do not
properly sanitize their inputs, leading to undefined behavior. This
commit adds a check to ensure that the pin number is valid before
accessing the arduino_pins array.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
@pillo79 pillo79 force-pushed the pr-fix-invalid-pin-crash branch from 929cee6 to 64f42b3 Compare March 18, 2026 11:11
@github-actions
Copy link
Copy Markdown

Built 0.53.2-0.dev+64f42b36

CI run PASSED 🟢

ArtifactBoardCoreTestsRAMSketchesWarningsErrors
zephyr_contrib ek_ra8d1 📗

11.9%

2--
frdm_mcxn947 3 🏷️

58.0%

2--
frdm_rw612 1 🏷️

83.0%

2--
✔️* zephyr_main giga 4 🏷️ ✅*

54.5%

448-
nano33ble 1 🏷️ ✅*

78.7%

228-
nano_matter 📗 ✔️*

⚠️ 85.7%

208(2*)
niclasense 2 🏷️ ✅*

⚠️ 87.3%

208-
opta 4 🏷️ ✔️*

46.7%

548(2*)
portentac33 3 🏷️ ✔️*

⚠️ 95.1%

568(8*)
portentah7 3 🏷️ ✔️*

47.3%

588(2*)
✅* zephyr_unoq unoq 📗 ✅*

26.4%

608-
Legend

BoardTestStatus description
🔥 🔥 Test run failed to complete.
🔴 Test completed with unexpected errors.
✔️* 🚫 Test completed with errors, but all are known/expected.
✅* 🟡 Test completed with some warnings; no errors detected.
🟢 Test passed successfully, with no warnings or errors.
🌑 🌑 Test was skipped.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 18, 2026

CLA assistant check
All committers have signed the CLA.

@pennam pennam merged commit 283b9b9 into arduino:main Mar 19, 2026
48 checks passed
@per1234 per1234 added the enhancement New feature or request label Mar 22, 2026
@pillo79 pillo79 deleted the pr-fix-invalid-pin-crash branch March 24, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants