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

[Bug] oled_write_raw overruns data buffer, corrupts display when cursor not at origin (0, 0) #13203

Closed
3 tasks
bcat opened this issue Jun 13, 2021 · 0 comments · Fixed by #13204
Closed
3 tasks

Comments

@bcat
Copy link
Contributor

bcat commented Jun 13, 2021

Describe the Bug

The oled_write_raw function reads from the data buffer and copies to oled_buffer, but it incorrectly offsets reads from data if the oled_cursor isn't at the start of the buffer. This means it reads beyond the end of the data buffer and corrupts the display.

PR #10800 updated oled_write_raw and oled_write_raw_P to respect the cursor position, but it looks like it also introduced this bug. It only happens for the non-PROGMEM variant of the function, which I suspect is why it hasn't been caught before. (Most folks probably use the PROGMEM variant on AVR boards, but I'm on an ARM board where oled_write_raw_P is just an alias for oled_write_raw.)

The fix is straightforward enough: use the oled_cursor offset for the write to oled_buffer, but not the read from data.

System Information

  • Keyboard: Unicorne (not yet merged, Add a new keyboard "Unicorne" #12993)
    • Revision (if applicable): f411
  • Operating system: Debian Buster on WSL2 (Linux wiggin 5.4.72-microsoft-standard-WSL2 #1 SMP Wed Oct 28 23:40:43 UTC 2020 x86_64 GNU/Linux)
  • AVR GCC version: avr-gcc (GCC) 5.4.0
  • ARM GCC version: arm-none-eabi-gcc (15:7-2018-q2-6) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]
  • QMK Firmware version: 0.13.2
  • Any keyboard related software installed?
    • AutoHotKey
    • Karabiner
    • Other:

Additional Context

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

Successfully merging a pull request may close this issue.

1 participant