aboutsummaryrefslogtreecommitdiff
path: root/games/openbor3482
diff options
context:
space:
mode:
authorJan Beich <jbeich@FreeBSD.org>2019-08-11 22:24:49 +0000
committerJan Beich <jbeich@FreeBSD.org>2019-08-11 22:24:49 +0000
commit21ab7fe69dfcc10ca05c10052156869cd80e5c55 (patch)
treeccb003aa4b990d81a0a209a0d800ae13df9cd591 /games/openbor3482
parentce5a6de0c93364b250956e6da6bad102366a6082 (diff)
downloadports-21ab7fe69dfcc10ca05c10052156869cd80e5c55.tar.gz
ports-21ab7fe69dfcc10ca05c10052156869cd80e5c55.zip
games/openbor: fix free memory stats
source/ramlib/ram.c:137:18: runtime error: unsigned integer overflow: 9420649 * 4096 cannot be represented in type 'unsigned int' Reported by: -fsanitize=integer
Notes
Notes: svn path=/head/; revision=508689
Diffstat (limited to 'games/openbor3482')
-rw-r--r--games/openbor3482/Makefile2
-rw-r--r--games/openbor3482/files/patch-source_ramlib_ram.c12
2 files changed, 7 insertions, 7 deletions
diff --git a/games/openbor3482/Makefile b/games/openbor3482/Makefile
index 92a8ef30b4cb..553d748cf3de 100644
--- a/games/openbor3482/Makefile
+++ b/games/openbor3482/Makefile
@@ -1,7 +1,7 @@
# $FreeBSD$
PORTVERSION= 3482
-PORTREVISION= 1
+PORTREVISION= 2
PKGNAMESUFFIX= ${PORTVERSION}
MASTERDIR= ${.CURDIR}/../openbor
diff --git a/games/openbor3482/files/patch-source_ramlib_ram.c b/games/openbor3482/files/patch-source_ramlib_ram.c
index c1609f723ea0..4a5a760fc13a 100644
--- a/games/openbor3482/files/patch-source_ramlib_ram.c
+++ b/games/openbor3482/files/patch-source_ramlib_ram.c
@@ -82,8 +82,8 @@ Implement Linux-like memory stats for BSDs
+ {
+ return 0;
+ }
-+ return (u64)((vms.v_free_count + vms.v_inactive_count
-+ + vms.v_cache_count) * getpagesize()) / byte_size;
++ return (u64)(vms.v_free_count + vms.v_inactive_count
++ + vms.v_cache_count) * getpagesize() / byte_size;
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ u_int v_free_count = 0, v_inactive_count = 0, v_cache_count = 0;
+ size_t sz = sizeof(u_int);
@@ -93,8 +93,8 @@ Implement Linux-like memory stats for BSDs
+ &v_inactive_count, &sz, NULL, 0);
+ sysctlbyname("vm.stats.vm.v_cache_count",
+ &v_cache_count, &sz, NULL, 0);
-+ return (u64)((v_free_count + v_inactive_count + v_cache_count)
-+ * getpagesize()) / byte_size;
++ return (u64)(v_free_count + v_inactive_count
++ + v_cache_count) * getpagesize() / byte_size;
+#elif defined(__NetBSD__) || defined(__OpenBSD__)
+# if defined(__NetBSD__)
+#undef VM_UVMEXP
@@ -115,8 +115,8 @@ Implement Linux-like memory stats for BSDs
+ {
+ return 0;
+ }
-+ return (u64)((uvmexp.free + uvmexp.inactive + uvmexp.filepages
-+ + uvmexp.execpages) * uvmexp.pagesize) / byte_size;
++ return (u64)(uvmexp.free + uvmexp.inactive + uvmexp.filepages
++ + uvmexp.execpages) * uvmexp.pagesize / byte_size;
#elif LINUX
struct sysinfo info;
sysinfo(&info);