Skip to content

Commit 841148d

Browse files
vchuravytopolarity
andauthored
Fix buffer overflow in jloptions (#60299)
Co-authored-by: Cody Tapscott <84105208+topolarity@users.noreply.github.com>
1 parent af36919 commit 841148d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/jloptions.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,9 +725,11 @@ JL_DLLEXPORT void jl_parse_opts(int *argcp, char ***argvp)
725725
}
726726
jl_options.nthreads = nthreads + nthreadsi;
727727
}
728+
assert(jl_options.nthreadpools == 1 || jl_options.nthreadpools == 2);
728729
int16_t *ntpp = (int16_t *)malloc_s(jl_options.nthreadpools * sizeof(int16_t));
729730
ntpp[0] = (int16_t)nthreads;
730-
ntpp[1] = (int16_t)nthreadsi;
731+
if (jl_options.nthreadpools == 2)
732+
ntpp[1] = (int16_t)nthreadsi;
731733
jl_options.nthreads_per_pool = ntpp;
732734
break;
733735
}

0 commit comments

Comments
 (0)