[qfcc] Fix some crashes when parsing bsp_turb.frag

Incorrect type accesses and unnamed interfaces.
This commit is contained in:
Bill Currie 2024-11-19 17:15:42 +09:00
parent 34b94aec96
commit 28a85b1624
3 changed files with 4 additions and 3 deletions

View file

@ -1674,6 +1674,7 @@ get_name (const expr_t *e)
symbol_t *
get_struct_field (const type_t *t1, const expr_t *e1, const expr_t *e2)
{
t1 = unalias_type (t1);
symtab_t *strct = t1->symtab;
symbol_t *sym = get_name (e2);
symbol_t *field;

View file

@ -1394,11 +1394,11 @@ binary_expr (int op, const expr_t *e1, const expr_t *e2)
}
if (is_constant (e1) && is_double (t1) && e1->implicit && is_float (t2)) {
t1 = float_type (t2);
t1 = float_type (base_type (t2));
e1 = cast_expr (t1, e1);
}
if (is_constant (e2) && is_double (t2) && e2->implicit && is_float (t1)) {
t2 = float_type (t1);
t2 = float_type (base_type (t1));
e2 = cast_expr (t2, e2);
}
if (is_array (t1) && (is_pointer (t2) || is_integral (t2))) {

View file

@ -45,7 +45,7 @@ void
glsl_parse_declaration (specifier_t spec, symbol_t *sym, const expr_t *init,
symtab_t *symtab, expr_t *block)
{
if (sym->type) {
if (sym && sym->type) {
internal_error (0, "unexected typed symbol");
}
auto attributes = glsl_optimize_attributes (spec.attributes);