Crash when a constant null typeid is checked for properties. #1679

This commit is contained in:
Christoffer Lerno
2024-12-14 15:13:43 +01:00
parent a8aad53038
commit 3dd725a0f0
2 changed files with 2 additions and 0 deletions

View File

@@ -41,6 +41,7 @@
- Incorrect "no-libc" definition of `cos`, making it unavailable for wasm.
- Fix issue with the adjoint and inverse calculations for `Matrix2x2`.
- It was possible to create 0 length arrays using byte literals. #1678
- Crash when a constant null typeid is checked for properties. #1679
### Stdlib changes
- Add `io::MultiReader`, `io::MultiWriter`, and `io::TeeReader` structs.

View File

@@ -4289,6 +4289,7 @@ static bool sema_expr_rewrite_to_typeid_property(SemaContext *context, Expr *exp
if (sema_cast_const(typeid))
{
Type *type = typeid->const_expr.typeid;
if (type == NULL) return false;
if (!sema_type_property_is_valid_for_type(type, property)) return false;
*was_error = !sema_expr_rewrite_to_type_property(context, expr, type, property, type);
return true;