Fix integer overflow

This commit is contained in:
bixiaoyan 2023-11-07 16:14:31 +08:00
parent 11247adf11
commit 787227eb16
2 changed files with 41 additions and 2 deletions

View File

@ -0,0 +1,35 @@
From 4f3402e69339d6589bec100cda780a250d326c2a Mon Sep 17 00:00:00 2001
From: bixiaoyan <bixiaoyan@kylinos.cn>
Date: Tue, 7 Nov 2023 16:10:19 +0800
Subject: [PATCH] Handling integer overflow
---
exec/cs_queue.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/exec/cs_queue.h b/exec/cs_queue.h
index 04dd4bb..3dd7233 100644
--- a/exec/cs_queue.h
+++ b/exec/cs_queue.h
@@ -46,15 +46,15 @@ struct cs_queue {
int tail;
int used;
int usedhw;
- int size;
+ size_t size;
void *items;
- int size_per_item;
+ size_t size_per_item;
int iterator;
pthread_mutex_t mutex;
int threaded_mode_enabled;
};
-static inline int cs_queue_init (struct cs_queue *cs_queue, int cs_queue_items, int size_per_item, int threaded_mode_enabled) {
+static inline int cs_queue_init (struct cs_queue *cs_queue, size_t cs_queue_items, size_t size_per_item, int threaded_mode_enabled) {
cs_queue->head = 0;
cs_queue->tail = cs_queue_items - 1;
cs_queue->used = 0;
--
2.33.0

View File

@ -18,7 +18,7 @@
Name: corosync
Summary: The Corosync Cluster Engine and Application Programming Interfaces
Version: 3.1.7
Release: 4
Release: 5
License: BSD-3-Clause
URL: http://corosync.github.io/corosync/
Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz
@ -26,7 +26,7 @@ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version
# https://github.com/corosync/corosync/pull/717
Patch0: Use-knet-TRACE-logging-level-if-available.patch
Patch1: Fail-to-start-if-knet-ping-timers-are-invalid.patch
Patch2: Fix-integer-overflow.patch
# Runtime bits
# The automatic dependency overridden in favor of explicit version lock
Requires: corosynclib = %{version}-%{release}
@ -76,6 +76,7 @@ BuildRequires: readline-devel
%setup -q -n %{name}-%{version}%{?gittarver}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%build
%if %{with runautogen}
@ -293,6 +294,9 @@ network splits)
%endif
%changelog
* Tue Nov 7 2023 bixiaoyan <bixiaoyan@kylinos.cn> - 3.1.7-5
- Fix integer overflow
* Thu Oct 26 2023 zouzhimin <zouzhimin@kylinos.cn> - 3.1.7-4
- Fail to start if knet ping timers are invalid