Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
8286511: Improve macro allocation
Browse files Browse the repository at this point in the history
Reviewed-by: yan
Backport-of: 4ab7ce961a95d7ba350b1cbca584a8e698186047
  • Loading branch information
Alexander Zuev authored and Yuri Nesterenko committed Oct 18, 2022
1 parent a2a6771 commit cb72352
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions make/common/modules/LauncherCommon.gmk
Expand Up @@ -44,6 +44,7 @@ endif

LAUNCHER_SRC := $(TOPDIR)/src/java.base/share/native/launcher
LAUNCHER_CFLAGS += -I$(TOPDIR)/src/java.base/share/native/launcher \
-I$(TOPDIR)/src/java.desktop/share/native/include \
-I$(TOPDIR)/src/java.base/share/native/libjli \
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli \
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libjli \
Expand Down
4 changes: 4 additions & 0 deletions make/modules/java.desktop/lib/Awt2dLibraries.gmk
Expand Up @@ -370,6 +370,7 @@ ifeq ($(call isTargetOs, windows macosx), false)
common/awt/debug \
common/font \
common/java2d/opengl \
include \
#

LIBAWT_HEADLESS_CFLAGS := $(CUPS_CFLAGS) $(FONTCONFIG_CFLAGS) $(X_CFLAGS) \
Expand Down Expand Up @@ -476,6 +477,7 @@ LIBFONTMANAGER_EXTRA_HEADER_DIRS := \
libawt/java2d \
libawt/java2d/pipe \
libawt/java2d/loops \
include \
#

LIBFONTMANAGER_CFLAGS += $(LIBFREETYPE_CFLAGS)
Expand Down Expand Up @@ -653,6 +655,8 @@ ifeq ($(ENABLE_HEADLESS_ONLY), false)
common/awt/systemscale \
#

LIBSPLASHSCREEN_HEADER_DIRS += include

ifeq ($(USE_EXTERNAL_LIBGIF), false)
LIBSPLASHSCREEN_HEADER_DIRS += libsplashscreen/giflib
else
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2022, 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
Expand Down Expand Up @@ -46,8 +46,13 @@

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

#define IS_MUL_OVERFLOW(m, n) \
((m) != 0 && (n) != 0 && (((size_t)((m)*(n))) != (((size_t)(m)) * ((size_t)(n)))))

#define IS_SAFE_SIZE_MUL(m, n) \
(IS_SAFE_SIZE_T(m) && IS_SAFE_SIZE_T(n) && ((m) == 0 || (n) == 0 || (size_t)(n) <= (SIZE_MAX / (size_t)(m))))
(IS_SAFE_SIZE_T(m) && IS_SAFE_SIZE_T(n) && \
((m) == 0 || (n) == 0 || (size_t)(n) <= (SIZE_MAX / (size_t)(m))) && \
!IS_MUL_OVERFLOW(m, n))

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

0 comments on commit cb72352

Please sign in to comment.