fix a potential infinite loop

This commit is contained in:
Kou Wenqi 2022-07-12 16:39:28 +08:00
parent cc7cedfad0
commit bd9c19fdef
2 changed files with 33 additions and 1 deletions

View File

@ -0,0 +1,27 @@
From 7fe098ae34b54d41ec9273c7ae51ee8e708c8193 Mon Sep 17 00:00:00 2001
From: Kou Wenqi <kouwenqi@kylinos.cn>
Date: Mon, 20 Jun 2022 17:31:32 +0800
Subject: [PATCH] fix a potential infinite loop
---
src/dbinc/shqueue.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/dbinc/shqueue.h b/src/dbinc/shqueue.h
index 5fdbf47..8f185b5 100644
--- a/src/dbinc/shqueue.h
+++ b/src/dbinc/shqueue.h
@@ -261,8 +261,8 @@ struct { \
#define SH_TAILQ_NEXTP(elm, field, type) \
((struct type *)((u_int8_t *)(elm) + (elm)->field.stqe_next))
-#define SH_TAILQ_NEXT(elm, field, type) \
- ((elm)->field.stqe_next == -1 ? NULL : \
+#define SH_TAILQ_NEXT(elm, field, type) \
+ (((elm)->field.stqe_next == -1 || (elm)->field.stqe_next == 0) ? NULL : \
((struct type *)((u_int8_t *)(elm) + (elm)->field.stqe_next)))
/*
--
2.23.0

View File

@ -1,6 +1,6 @@
Name: libdb
Version: 5.3.28
Release: 38
Release: 39
Summary: The Berkeley DB database library for C
License: BSD and LGPLv2 and Sleepycat
URL: https://www.oracle.com/database/berkeley-db/
@ -38,6 +38,7 @@ Patch38: bugfix-fix-deadlock-on-mempool-file-locks.patch
Patch39: libdb-limit-cpu.patch
Patch40: libdb-cbd-race.patch
Patch41: add-check-for-device-number-in-__check_lock_fn.patch
Patch42: fix-a-potential-infinite-loop.patch
BuildRequires: gcc gcc-c++ perl-interpreter libtool tcl-devel >= 8.5.2-3
BuildRequires: java-devel >= 1:1.6.0 chrpath zlib-devel
@ -118,6 +119,7 @@ popd
%patch39 -p1
%patch40 -p1
%patch41 -p1
%patch42 -p1
pushd dist
./s_config
@ -210,6 +212,9 @@ mv man/* %{buildroot}%{_mandir}/man1/
%{_mandir}/man1
%changelog
* Tue Jul 12 2022 Kou Wenqi <kouwenqi@kylinos.cn> - 5.3.28-39
- Fix a potential infinite loop
* Tue Jun 28 2022 panxiaohe <panxh.life@foxmail.com> - 5.3.28-38
- add check for device number in __check_lock_fn