8345676: [ubsan] ProcessImpl_md.c:561:40: runtime error: applying zero offset to null pointer on macOS aarch64

Reviewed-by: rriggs
This commit is contained in:
Matthias Baesken 2025-01-07 08:15:12 +00:00
parent 0a81676fae
commit 0285020c7e

View File

@ -558,7 +558,9 @@ spawnChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath)
return -1;
}
offset = copystrings(buf, 0, &c->argv[0]);
offset = copystrings(buf, offset, &c->envv[0]);
if (c->envv != NULL) {
offset = copystrings(buf, offset, &c->envv[0]);
}
if (c->pdir != NULL) {
if (sp.dirlen > 0) {
memcpy(buf+offset, c->pdir, sp.dirlen);