mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 06:11:05 +01:00
Don't crash if a builtin fn is declared with positional parameters. (#5444)
Crash discovered by fuzzer.
This commit is contained in:
@@ -681,6 +681,11 @@ static auto IsValidBuiltinDeclaration(Context& context,
|
||||
const SemIR::Function& function,
|
||||
SemIR::BuiltinFunctionKind builtin_kind)
|
||||
-> bool {
|
||||
if (!function.call_params_id.has_value()) {
|
||||
// For now, we have no builtins that support positional parameters.
|
||||
return false;
|
||||
}
|
||||
|
||||
// Find the list of call parameters other than the implicit return slot.
|
||||
auto call_params = context.inst_blocks().Get(function.call_params_id);
|
||||
if (function.return_slot_pattern_id.has_value()) {
|
||||
|
||||
Reference in New Issue
Block a user