Repository navigation
Fix out-of-bounds row in Keychron RGB LED index query - #553
Open
edusperoni wants to merge 1 commit into
Open
edusperoni wants to merge 1 commit into
edusperoni wants to merge 1 commit into
Conversation
rgb_get_led_idx accepted row == MATRIX_ROWS and read one row past the end of g_led_config.matrix_co, returning bytes of g_led_config.point as LED indices. Hosts that scan rows until the firmware rejects one, such as OpenRGB, then place an unrelated LED in a row that does not exist.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
rgb_get_led_idx(Keychron RGB protocol,RGB_GET_LED_IDX) rejects rows withrow > MATRIX_ROWS, so the query forrow == MATRIX_ROWSis accepted. It then reads one row past the end ofg_led_config.matrix_co, i.e. the start ofg_led_config.point, and returns those coordinate bytes as LED indices with a success status.Responses from a C3 Pro 8K (6×17 matrix) before this change, as
[status, col0, col1, …]:Host software that scans rows until the firmware rejects one, such as OpenRGB's Keychron controller, then places an unrelated LED in a row that doesn't exist. On the C3 Pro 8K, side light 97 shows up at (6,12). Boards whose
pointbytes only match LEDs that are already placed aren't visibly affected, but every board built withkeychron_rgb.creturns the out-of-bounds data.The fix uses
>=, matching the other matrix bounds checks inkeyboards/keychron/common(for exampleanalog_matrix.c).Built
keychron/c3_pro_8k/iso:keychron,keychron/q1_max/ansi_encoder:keychronandkeychron/k8_max/ansi/rgb:keychron.Types of Changes
Issues Fixed or Closed by This PR
Checklist