1
0
mirror of https://github.com/janet-lang/janet synced 2025-09-01 02:18:03 +00:00

Merge pull request #826 from rick2600/fix-uaf-cfun_array_concat

fix issue #825
This commit is contained in:
Calvin Rose
2021-10-06 17:48:27 -05:00
committed by GitHub

View File

@@ -241,6 +241,11 @@ JANET_CORE_FN(cfun_array_concat,
int32_t j, len = 0;
const Janet *vals = NULL;
janet_indexed_view(argv[i], &vals, &len);
if (array->data == vals) {
int32_t newcount = array->count + len;
janet_array_ensure(array, newcount, 2);
janet_indexed_view(argv[i], &vals, &len);
}
for (j = 0; j < len; j++)
janet_array_push(array, vals[j]);
}