Skip to content

Commit 0285020

Browse files
committed
8345676: [ubsan] ProcessImpl_md.c:561:40: runtime error: applying zero offset to null pointer on macOS aarch64
Reviewed-by: rriggs
1 parent 0a81676 commit 0285020

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/java.base/unix/native/libjava/ProcessImpl_md.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,9 @@ spawnChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath)
558558
return -1;
559559
}
560560
offset = copystrings(buf, 0, &c->argv[0]);
561-
offset = copystrings(buf, offset, &c->envv[0]);
561+
if (c->envv != NULL) {
562+
offset = copystrings(buf, offset, &c->envv[0]);
563+
}
562564
if (c->pdir != NULL) {
563565
if (sp.dirlen > 0) {
564566
memcpy(buf+offset, c->pdir, sp.dirlen);

0 commit comments

Comments
 (0)