Skip to content

Fix CVE-2025-3010: Null pointer dereference in isConversionAllowed#4169

Open
cnDelbert wants to merge 2 commits intoKhronosGroup:mainfrom
cnDelbert:fix/cve-2025-3010
Open

Fix CVE-2025-3010: Null pointer dereference in isConversionAllowed#4169
cnDelbert wants to merge 2 commits intoKhronosGroup:mainfrom
cnDelbert:fix/cve-2025-3010

Conversation

@cnDelbert
Copy link

Added a null check for 'node' in TIntermediate::isConversionAllowed to prevent a null pointer dereference when processing malformed HLSL conditional expressions.

This addresses the vulnerability reported in CVE-2025-3010 where a crafted shader could cause a crash due to missing validation before accessing node->getBasicType().

References:

Added a null check for 'node' in TIntermediate::isConversionAllowed to prevent a null pointer dereference when processing malformed HLSL conditional expressions.

This addresses the vulnerability reported in CVE-2025-3010 where a crafted shader could cause a crash due to missing validation before accessing node->getBasicType().

References:
- CVE-2025-3010
- KhronosGroup#3903
@CLAassistant
Copy link

CLAassistant commented Feb 2, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@arcady-lunarg arcady-lunarg left a comment

Choose a reason for hiding this comment

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

You will need to add your test to one of the lists of tests in gtests/Hlsl.FromFile.cpp and generate an expected test result using build/gtests/glslangtests --update-mode

Added hlsl.cve-2025-3010.frag to gtests/Hlsl.FromFile.cpp and generated
the expected result file Test/baseResults/hlsl.cve-2025-3010.frag.out
as requested by maintainers.
@cnDelbert
Copy link
Author

@arcady-lunarg I have added the test case to gtests/Hlsl.FromFile.cpp and generated the expected output file Test/baseResults/hlsl.cve-2025-3010.frag.out using the compiled validator. The PR has been updated with these changes.

@arcady-lunarg arcady-lunarg added the kokoro:run Trigger Google bot runs label Feb 12, 2026
@kokoro-team kokoro-team removed the kokoro:run Trigger Google bot runs label Feb 12, 2026
@pmistryNV
Copy link
Contributor

Seems like ToSpirv/HlslCompileTest.FromFile/hlsl_cve_2025_3010_frag is failing. Can you please check? Let me know if you need help with upstreaming

Copy link
Collaborator

@dnovillo dnovillo left a comment

Choose a reason for hiding this comment

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

The golden output generated starts with Test\. It should not have the path, just the shader name. That seems to be the failure you're getting.

bool TIntermediate::isConversionAllowed(TOperator op, TIntermTyped* node) const
{
if (node == nullptr)
return false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems like it's papering over the issue. The HLSL frontend is generating a nil node and passing it down. While this prevents the crash, it will silently supresses a potential semantic error. Where is this nil pointer generated? That is probably the spot to fix.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This file seems like a valid HLSL shader? The CVE should produce a nil TIntermTyped*. Do you have the original invalid shader?

@cnDelbert
Copy link
Author

@sae-as-me Would you please help to fix or provide some shader examples?

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.

6 participants