Skip to content

Ensure VARIANT instances are actually VT_BSTR before treating them as such in OS_Windows::get_video_adapter_driver_info()#105548

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
jss2a98aj:windows-validate-VARIANT-in-get_video_adapter_driver_info
Apr 22, 2025
Merged

Ensure VARIANT instances are actually VT_BSTR before treating them as such in OS_Windows::get_video_adapter_driver_info()#105548
Repiteo merged 1 commit intogodotengine:masterfrom
jss2a98aj:windows-validate-VARIANT-in-get_video_adapter_driver_info

Conversation

@jss2a98aj
Copy link
Contributor

@jss2a98aj jss2a98aj commented Apr 18, 2025

Calling OS.get_video_adapter_driver_info() can cause a crash or return garbage on Windows due to some VARIANT instances not being checked to ensure they are actually set to VT_BSTR.

Garbage data from an impacted system:
["䣀⃺", "30.0.14.7411"]
Results from the same system after adding checks:
["NVIDIA", "30.0.14.7411"]

I have only seen this cause crashes or garbage outputs due to the the very first place that is checked not being a VT_BSTR, but checking all areas it can happen in should ensure similar behavior will not happen again. In cases where no driver name and/or version would be given I have set the impacted string(s) to "Unknown". If this is undesired behavior I can adjust it to accommodate.

@jss2a98aj jss2a98aj requested a review from a team as a code owner April 18, 2025 23:19
@AThousandShips AThousandShips added this to the 4.5 milestone Apr 19, 2025
@Repiteo Repiteo merged commit 3d0107c into godotengine:master Apr 22, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Apr 22, 2025

Thanks!

@jss2a98aj
Copy link
Contributor Author

Can this be cherry-picked to older 4.X versions that have get_video_adapter_driver_info? Most systems may not be impacted, but because the ones that are can experience a rare crash I would like to see it fixed.

@jss2a98aj jss2a98aj deleted the windows-validate-VARIANT-in-get_video_adapter_driver_info branch April 26, 2025 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants