aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2024-06-08 23:14:55 +0200
committerGitHub <noreply@github.com>2024-06-08 23:14:55 +0200
commit0d698c7b53d63c4017fa35363ac9cbcaee170458 (patch)
treef83695ae38cfd16a4cf7c519eba7401a347f0d28 /src
parente5bf6fd3aa442c746c9540e97fc76110b3f6ee06 (diff)
parent49f147cc86d06ee60dd6936404b18f952196d9a8 (diff)
Merge pull request #3709 from Feoramund/stop-low-swizzle
Prevent panic when `swizzle` called with < 2 indices
Diffstat (limited to 'src')
-rw-r--r--src/check_builtin.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp
index eef925d94..98c695a2c 100644
--- a/src/check_builtin.cpp
+++ b/src/check_builtin.cpp
@@ -2419,6 +2419,9 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
if (arg_count > max_count) {
error(call, "Too many 'swizzle' indices, %td > %td", arg_count, max_count);
return false;
+ } else if (arg_count < 2) {
+ error(call, "Not enough 'swizzle' indices, %td < 2", arg_count);
+ return false;
}
if (type->kind == Type_Array) {