From 0285020c7ea01f32b32efe166a0a5dae39957216 Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Tue, 7 Jan 2025 08:15:12 +0000 Subject: [PATCH] 8345676: [ubsan] ProcessImpl_md.c:561:40: runtime error: applying zero offset to null pointer on macOS aarch64 Reviewed-by: rriggs --- src/java.base/unix/native/libjava/ProcessImpl_md.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/java.base/unix/native/libjava/ProcessImpl_md.c b/src/java.base/unix/native/libjava/ProcessImpl_md.c index 506b33aae96..5a3a5cd088a 100644 --- a/src/java.base/unix/native/libjava/ProcessImpl_md.c +++ b/src/java.base/unix/native/libjava/ProcessImpl_md.c @@ -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);