Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OOB write in matrix constructor #2656

Merged
merged 1 commit into from
Jun 4, 2021

Conversation

ShabbyX
Copy link
Contributor

@ShabbyX ShabbyX commented Jun 3, 2021

In a matrix constructor that takes a number of components, as many
components as necessary must be taken, with the rest discarded, as GLSL
allows more components than necessary to be specified. For example, the
following:

mat4 m4 = mat4(v4, v4.yzwx, v4.zwx, v4.zwxy, v4.wxyz);

is equivalent to:

mat4 m4 = mat4(v4, v4.yzwx, v4.zwx, v4.zwxy, v4.w);

glslang takes the components from the constructor and builds the single
components of the matrix in a 2D array before constructing the matrix
itself. It however did not check for extra parameters and was thus
writing OOB to said 2D array. This is fixed in this change

Signed-off-by: Shahbaz Youssefi shabbyx@gmail.com

In a matrix constructor that takes a number of components, as many
components as necessary must be taken, with the rest discarded, as GLSL
allows more components than necessary to be specified.  For example, the
following:

    mat4 m4 = mat4(v4, v4.yzwx, v4.zwx, v4.zwxy, v4.wxyz);

is equivalent to:

    mat4 m4 = mat4(v4, v4.yzwx, v4.zwx, v4.zwxy, v4.w);

glslang takes the components from the constructor and builds the single
components of the matrix in a 2D array before constructing the matrix
itself.  It however did not check for extra parameters and was thus
writing OOB to said 2D array.  This is fixed in this change

Signed-off-by: Shahbaz Youssefi <shabbyx@gmail.com>
@ShabbyX
Copy link
Contributor Author

ShabbyX commented Jun 3, 2021

@greg-lunarg another clusterfuzz bug found

@greg-lunarg greg-lunarg added the kokoro:run Trigger Google bot runs label Jun 4, 2021
@kokoro-team kokoro-team removed the kokoro:run Trigger Google bot runs label Jun 4, 2021
Copy link
Contributor

@greg-lunarg greg-lunarg left a comment

Choose a reason for hiding this comment

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

LGTM. No regression test required.

@greg-lunarg greg-lunarg merged commit 2675cc3 into KhronosGroup:master Jun 4, 2021
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