Skip to content

Fixes issue in SX1509::readWord(uint8_t, uint16_t *) #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Willmac16
Copy link

Existing implementation accessed memory it shouldn't, and didn't write both values to the target uint16_t.

Existing implementation accessed memory it shouldn't, and didn't write both values to the target uint16_t.
@Willmac16
Copy link
Author

For reference, when the original code is run, my compiler spits out:

.pio/libdeps/teensymm/SX1509 IO Expander/src/SparkFunSX1509.cpp: In member function 'bool SX1509::readPin(uint8_t, bool*)':
.pio/libdeps/teensymm/SX1509 IO Expander/src/SparkFunSX1509.cpp:789:26: warning: array subscript 1 is outside array bounds of 'uint16_t [1]' {aka 'short unsigned int [1]'} [-Warray-bounds]
  789 |                 value[1] = dest[0];
      |                 ~~~~~~~~~^~~~~~~~~
.pio/libdeps/teensymm/SX1509 IO Expander/src/SparkFunSX1509.cpp:212:18: note: while referencing 'tempRegDir'
  212 |         uint16_t tempRegDir;

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.

1 participant