Skip to content

loader: Fix missing bounds check in parse_id_filter_environment_var#1910

Merged
charles-lunarg merged 1 commit into
KhronosGroup:mainfrom
kaushalrog:fix/id-filter-bounds-check
Jun 1, 2026
Merged

loader: Fix missing bounds check in parse_id_filter_environment_var#1910
charles-lunarg merged 1 commit into
KhronosGroup:mainfrom
kaushalrog:fix/id-filter-bounds-check

Conversation

@kaushalrog

Copy link
Copy Markdown

Both parse_generic_filter_environment_var and
parse_layers_disable_filter_environment_var correctly guard against exceeding MAX_ADDITIONAL_FILTERS before writing into their fixed-size filter arrays. parse_id_filter_environment_var was the only filter parser that lacked this guard, meaning a sufficiently long comma- separated environment variable (e.g. VK_LOADER_DEBUG) could write beyond the end of loader_envvar_id_filter::filters[MAX_ADDITIONAL_FILTERS], overflowing the stack or adjacent heap memory.

Add the same count >= MAX_ADDITIONAL_FILTERS early-break that the other two parsers already use, and emit a WARN log entry so users know that entries beyond the limit are silently ignored.

Fixes: write past end of loader_envvar_id_filter::filters[]
Reported-by: code review
Reviewed-by: (pending)

Both parse_generic_filter_environment_var and
parse_layers_disable_filter_environment_var correctly guard against
exceeding MAX_ADDITIONAL_FILTERS before writing into their fixed-size
filter arrays. parse_id_filter_environment_var was the only filter
parser that lacked this guard, meaning a sufficiently long comma-
separated environment variable (e.g. VK_LOADER_DEBUG) could write
beyond the end of loader_envvar_id_filter::filters[MAX_ADDITIONAL_FILTERS],
overflowing the stack or adjacent heap memory.

Add the same count >= MAX_ADDITIONAL_FILTERS early-break that the other
two parsers already use, and emit a WARN log entry so users know that
entries beyond the limit are silently ignored.

Fixes: write past end of loader_envvar_id_filter::filters[]
Reported-by: code review
Reviewed-by: (pending)
@ci-tester-lunarg

Copy link
Copy Markdown

Author kaushalrog not on autobuild list. Waiting for curator authorization before starting CI build.

1 similar comment
@ci-tester-lunarg

Copy link
Copy Markdown

Author kaushalrog not on autobuild list. Waiting for curator authorization before starting CI build.

@CLAassistant

CLAassistant commented Jun 1, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@ci-tester-lunarg

Copy link
Copy Markdown

CI Vulkan-Loader build queued with queue ID 752283.

@ci-tester-lunarg

Copy link
Copy Markdown

CI Vulkan-Loader build # 3497 running.

@ci-tester-lunarg

Copy link
Copy Markdown

CI Vulkan-Loader build # 3497 passed.

@charles-lunarg charles-lunarg merged commit cf0cf82 into KhronosGroup:main Jun 1, 2026
46 checks passed
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.

4 participants