mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 00:38:48 +02:00
spirv: fix OpUntypedVariableKHR with optional data type parameter
This would read OOB and crash because data type is optional per the
SPIRV spec.
Original patch by Faith Ekstrand <faith.ekstrand@collabora.com>.
Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
(cherry picked from commit 1f8be7bfad)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
This commit is contained in:
parent
b3b0c9002e
commit
46aea87a79
2 changed files with 8 additions and 2 deletions
|
|
@ -5254,7 +5254,7 @@
|
|||
"description": "spirv: fix OpUntypedVariableKHR with optional data type parameter",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -2706,7 +2706,13 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
|
|||
const bool untyped = opcode == SpvOpUntypedVariableKHR;
|
||||
|
||||
struct vtn_type *ptr_type = vtn_get_type(b, w[1]);
|
||||
struct vtn_type *data_type = untyped ? vtn_get_type(b, w[4]) : ptr_type->pointed;
|
||||
struct vtn_type *data_type =
|
||||
untyped && count > 4 ? vtn_get_type(b, w[4]) : ptr_type->pointed;
|
||||
if (data_type == NULL) {
|
||||
data_type = vtn_zalloc(b, struct vtn_type);
|
||||
data_type->base_type = vtn_base_type_void;
|
||||
data_type->type = glsl_void_type();
|
||||
}
|
||||
|
||||
SpvStorageClass storage_class = w[3];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue