mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-01 22:18:23 +00:00
8347272: [ubsan] JvmLauncher.cpp:262:52: runtime error: applying non-zero offset 40 to null pointer
Reviewed-by: almatvee, mbaesken
This commit is contained in:
parent
5fec999474
commit
fb066caea8
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -259,7 +259,8 @@ private:
|
||||
|
||||
int initJvmlLauncherData(JvmlLauncherData* ptr) const {
|
||||
// Store path to JLI library just behind JvmlLauncherData header.
|
||||
char* curPtr = reinterpret_cast<char*>(ptr + 1);
|
||||
JvmlLauncherData dummy;
|
||||
char* curPtr = reinterpret_cast<char*>((ptr ? ptr : &dummy) + 1);
|
||||
{
|
||||
const size_t count = sizeof(char)
|
||||
* (jliLibPath.size() + 1 /* trailing zero */);
|
||||
@ -304,7 +305,7 @@ private:
|
||||
curPtr = copyStrings(envVarValues, ptr,
|
||||
offsetof(JvmlLauncherData, envVarValues), curPtr);
|
||||
|
||||
const size_t bufferSize = curPtr - reinterpret_cast<char*>(ptr);
|
||||
const size_t bufferSize = curPtr - reinterpret_cast<char*>(ptr ? ptr : &dummy);
|
||||
if (ptr) {
|
||||
LOG_TRACE(tstrings::any() << "Initialized " << bufferSize
|
||||
<< " bytes at " << ptr << " address");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user