bsp: renesas: fix LCD framebuffer bounds#11572
Conversation
The Renesas LCD helper treats LCD_WIDTH and LCD_HEIGHT as pixel counts. The framebuffer clear loop and lcd_draw_pixel() accepted those count values as valid indexes, which can write one pixel past the framebuffer. Use strict bounds for the 0-based framebuffer indexes and adjust the 180-degree rotation mapping to target the last valid row and column. Generated-by: OpenAI Codex Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
📌 Code Review Assignment🏷️ Tag: bsp_renesasReviewers: @kurisaW Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2026-07-06 11:04 CST)
📝 Review Instructions
|
What this PR does
Fixes off-by-one framebuffer writes in the Renesas LCD helper.
LCD_WIDTHandLCD_HEIGHTare pixel counts, so valid framebuffer coordinates are0..LCD_WIDTH - 1and0..LCD_HEIGHT - 1.This updates:
LCD_BUF_SIZE / sizeof(uint16_t)lcd_draw_pixel()bounds to rejectx == LCD_WIDTHandy == LCD_HEIGHTVerification
git diff --checkgit show --stat --check --format=fuller HEADgit ls-files --eol -- bsp/renesas/libraries/HAL_Drivers/drivers/drv_lcd.crg -n "i <= LCD_BUF_SIZE / sizeof\(uint16_t\)|x <= LCD_WIDTH|y <= LCD_HEIGHT|LCD_HEIGHT - y|LCD_WIDTH - x" bsp/renesas/libraries/HAL_Drivers/drivers/drv_lcd.creturns no matchesI could not run an RT-Thread build locally because this Windows environment does not have
scons,gcc, orarm-none-eabi-gccinstalled.Generated-by: OpenAI Codex