Skip to content
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

Bounds check for ws2812.buffer:replace does not work #2921

Closed
HHHartmann opened this issue Sep 21, 2019 · 1 comment
Closed

Bounds check for ws2812.buffer:replace does not work #2921

HHHartmann opened this issue Sep 21, 2019 · 1 comment
Assignees
Labels

Comments

@HHHartmann
Copy link
Member

I found this error while writing tests for this module.
So the effort was worth it right away.

Expected behavior

buffer:replace with invalid replace position throw an error.

Actual behavior

Does not abort and possibly corrupts memory.

Test code

strip_buffer = ws2812.newBuffer(5, 3)
strip_buffer:replace(string.char(3,255,165,33,0,244,12,87,255), -7)
strip_buffer:dump()

the last commad reboots the mcu after some seconds

NodeMCU version

NodeMCU 3.0.0.0
branch: dev
commit: 0b90495

Hardware

standard dev board

@HHHartmann HHHartmann self-assigned this Sep 22, 2019
@HHHartmann HHHartmann added the bug label Sep 22, 2019
@HHHartmann
Copy link
Member Author

Need to fix

static ptrdiff_t posrelat (ptrdiff_t pos, size_t len)

and adapt all occurrences if needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants