Zebediah Figura : d3dcompiler: Ensure that the lhs of an assignment is reducible to a variable.
Alexandre Julliard
julliard at winehq.org
Thu Mar 19 16:27:49 CDT 2020
Module: wine
Branch: master
Commit: aaa625217b202dc0a22d67e63e941b027146a456
URL: https://source.winehq.org/git/wine.git/?a=commit;h=aaa625217b202dc0a22d67e63e941b027146a456
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Sun Mar 15 16:25:13 2020 -0500
d3dcompiler: Ensure that the lhs of an assignment is reducible to a variable.
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3dcompiler_43/utils.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c
index 921ef7c2c7..6e9bb593e0 100644
--- a/dlls/d3dcompiler_43/utils.c
+++ b/dlls/d3dcompiler_43/utils.c
@@ -1456,6 +1456,29 @@ static unsigned int invert_swizzle(unsigned int *swizzle, unsigned int writemask
return new_writemask;
}
+static BOOL validate_lhs_deref(const struct hlsl_ir_node *lhs)
+{
+ struct hlsl_ir_deref *deref;
+
+ if (lhs->type != HLSL_IR_DEREF)
+ {
+ hlsl_report_message(lhs->loc, HLSL_LEVEL_ERROR, "invalid lvalue");
+ return FALSE;
+ }
+
+ deref = deref_from_node(lhs);
+
+ if (deref->src.type == HLSL_IR_DEREF_VAR)
+ return TRUE;
+ if (deref->src.type == HLSL_IR_DEREF_ARRAY)
+ return validate_lhs_deref(deref->src.v.array.array);
+ if (deref->src.type == HLSL_IR_DEREF_RECORD)
+ return validate_lhs_deref(deref->src.v.record.record);
+
+ assert(0);
+ return FALSE;
+}
+
struct hlsl_ir_node *make_assignment(struct hlsl_ir_node *lhs, enum parse_assign_op assign_op,
struct hlsl_ir_node *rhs)
{
@@ -1509,6 +1532,12 @@ struct hlsl_ir_node *make_assignment(struct hlsl_ir_node *lhs, enum parse_assign
lhs = lhs_inner;
}
+ if (!validate_lhs_deref(lhs))
+ {
+ d3dcompiler_free(assign);
+ return NULL;
+ }
+
TRACE("Creating proper assignment expression.\n");
if (writemask == BWRITERSP_WRITEMASK_ALL)
type = lhs->data_type;
More information about the wine-cvs
mailing list