Skip to content

parse driverVersion through valuedouble in parse_device_configuration - #2051

Merged
charles-lunarg merged 1 commit into
KhronosGroup:mainfrom
aizu-m:device-config-driver-version-u32
Oct 10, 2026
Merged

charles-lunarg merged 1 commit into
KhronosGroup:mainfrom
aizu-m:device-config-driver-version-u32

Conversation

@aizu-m

@aizu-m aizu-m commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Chased a report of a configured device vanishing from enumeration. The loader's own warning gave it away:

[Vulkan Loader] WARNING: loader_apply_settings_device_configurations: settings file contained device_configuration which does not appear in the enumerated VkPhysicalDevices. Missing VkPhysicalDevice with deviceUUID: 00010203-0405-0607-0809-0a0b0c0d0e0f, driverUUID: 10111213-1415-1617-1819-1a1b1c1d1e1f, driverVersion: 2147483647

The settings file said 2307751936, which is NVIDIA 550.54.0 with the major release packed into the top ten bits. parse_device_configuration reads the number through cJSON's valueint, and parse_number saturates valueint at INT_MAX. driverVersion is a uint32_t. Every NVIDIA driver from the 512 series on packs to a value above INT_MAX, so the equality check in loader_apply_settings_device_configurations can never match; once no configuration matches, vkEnumeratePhysicalDevices returns VK_ERROR_INITIALIZATION_FAILED.

Read the value through valuedouble with a [0, UINT32_MAX] range check instead, the same validation shape parse_uuid_array applies to its bytes. The driverVersion log sites used %d and printed these versions as negative numbers; switched to %u.

The new test fails before the change (configured device hidden, enumeration fails) and passes after.

cJSON's valueint saturates at INT_MAX, so a settings file device_configuration naming a driverVersion above it (any NVIDIA driver from the 512 series on) can never match the enumerated device and the device is dropped. Read the number through valuedouble with a range check, and print driverVersion with %u at its log sites.
@ci-tester-lunarg

Copy link
Copy Markdown

User aizu-m not on autobuild list. Waiting for curator authorization before starting CI build.

1 similar comment
@ci-tester-lunarg

Copy link
Copy Markdown

User aizu-m not on autobuild list. Waiting for curator authorization before starting CI build.

@ci-tester-lunarg

Copy link
Copy Markdown

CI Vulkan-Loader build queued with queue ID 152300.

@ci-tester-lunarg

Copy link
Copy Markdown

CI Vulkan-Loader build # 3807 running.

@ci-tester-lunarg

Copy link
Copy Markdown

CI Vulkan-Loader build # 3807 passed.

@charles-lunarg charles-lunarg left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, that goes to show how annoying mixing signed and unsigned types can be.
For years signed would have been fine, then one driver's version was large enough to exceed it.
Thanks for catching and fixing it.

@charles-lunarg
charles-lunarg merged commit b79d3f8 into KhronosGroup:main Oct 10, 2026
52 checks passed
@aizu-m

aizu-m commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the merge, glad this one landed.

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.

3 participants