Skip to content

Commit ae66dce

Browse files
mrserbRealCLanger
authored andcommitted
8286511: Improve macro allocation
Reviewed-by: mbalao Backport-of: 4ab7ce961a95d7ba350b1cbca584a8e698186047
1 parent 1d82816 commit ae66dce

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

make/common/modules/LauncherCommon.gmk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ endif
4444

4545
LAUNCHER_SRC := $(TOPDIR)/src/java.base/share/native/launcher
4646
LAUNCHER_CFLAGS += -I$(TOPDIR)/src/java.base/share/native/launcher \
47+
-I$(TOPDIR)/src/java.desktop/share/native/include \
4748
-I$(TOPDIR)/src/java.base/share/native/libjli \
4849
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli \
4950
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libjli \

make/modules/java.desktop/lib/Awt2dLibraries.gmk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ ifeq ($(call isTargetOs, windows macosx), false)
368368
common/awt/debug \
369369
common/font \
370370
common/java2d/opengl \
371+
include \
371372
#
372373

373374
LIBAWT_HEADLESS_CFLAGS := $(CUPS_CFLAGS) $(FONTCONFIG_CFLAGS) $(X_CFLAGS) \
@@ -477,6 +478,7 @@ LIBFONTMANAGER_EXTRA_HEADER_DIRS := \
477478
libawt/java2d \
478479
libawt/java2d/pipe \
479480
libawt/java2d/loops \
481+
include \
480482
#
481483

482484
LIBFONTMANAGER_CFLAGS += $(LIBFREETYPE_CFLAGS)
@@ -656,6 +658,8 @@ ifeq ($(ENABLE_HEADLESS_ONLY), false)
656658
common/awt/systemscale \
657659
#
658660

661+
LIBSPLASHSCREEN_HEADER_DIRS += include
662+
659663
ifeq ($(USE_EXTERNAL_LIBGIF), false)
660664
LIBSPLASHSCREEN_HEADER_DIRS += libsplashscreen/giflib
661665
else

src/java.base/share/native/libjava/sizecalc.h renamed to src/java.desktop/share/native/include/sizecalc.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -46,8 +46,13 @@
4646

4747
#define IS_SAFE_SIZE_T(x) ((x) >= 0 && (unsigned long long)(x) <= SIZE_MAX)
4848

49+
#define IS_MUL_OVERFLOW(m, n) \
50+
((m) != 0 && (n) != 0 && (((size_t)((m)*(n))) != (((size_t)(m)) * ((size_t)(n)))))
51+
4952
#define IS_SAFE_SIZE_MUL(m, n) \
50-
(IS_SAFE_SIZE_T(m) && IS_SAFE_SIZE_T(n) && ((m) == 0 || (n) == 0 || (size_t)(n) <= (SIZE_MAX / (size_t)(m))))
53+
(IS_SAFE_SIZE_T(m) && IS_SAFE_SIZE_T(n) && \
54+
((m) == 0 || (n) == 0 || (size_t)(n) <= (SIZE_MAX / (size_t)(m))) && \
55+
!IS_MUL_OVERFLOW(m, n))
5156

5257
#define IS_SAFE_SIZE_ADD(a, b) \
5358
(IS_SAFE_SIZE_T(a) && IS_SAFE_SIZE_T(b) && (size_t)(b) <= (SIZE_MAX - (size_t)(a)))

0 commit comments

Comments
 (0)