Issue 128987
Summary Buffer overflow with excess array initializers in #embed
Labels c23, clang:codegen
Assignees
Reporter efriedma-quic
    Testcase:

```
void f(int x) {
  int p[8] = {x, x, x, x, x, x, x,
#embed __FILE__ limit(3)
};
}
```

This stores to `p[8]` and `p[9]`, which are past the end of the array.

Related assertion:
```
void f(int x) {
  int p[8] = {x, x, x, x, x, x, x,
#embed __FILE__ limit(10)
};
}
```
```
llvm/include/llvm/Support/Casting.h:109: static bool llvm::isa_impl_cl<clang::ImplicitValueInitExpr, const clang::Expr *>::doit(const From *) [To = clang::ImplicitValueInitExpr, From = const clang::Expr *]: Assertion `Val && "isa<> used on a null pointer"' failed.
```

CC @Fznamznon 
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to