123 Star 0 Fork 10

src-openEuler/elinks

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
elinks-0.12pre6-list_is_singleton.patch 1.45 KB
一键复制 编辑 原始数据 按行查看 历史
fun_yang 提交于 2019-11-28 17:30 . package init
From 701b16e0ee6f159cbf8498f4569022005dfdebbd Mon Sep 17 00:00:00 2001
From: Kamil Dudka <[email protected]>
Date: Wed, 19 Mar 2014 11:48:34 +0100
Subject: [PATCH] lists.h: list_is_singleton() now returns false for empty list
We have a crash report of ELinks 0.12pre6 with backtrace going through
bookmark_all_terminals(). I believe it is caused by list_is_singleton()
returning true for an empty list. Consequently, bookmark_terminal()
attempts to access a list item that does not exist.
While it would be possible to fix bookmark_all_terminals() to explicitly
check the list for emptiness, I propose to fix list_is_singleton() such
that it does not return true for an empty list. I checked the other
uses of list_is_singleton() and the proposed change should not introduce
any change in the behavior elsewhere.
Bug: https://bugzilla.redhat.com/1075415
---
src/util/lists.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/util/lists.h b/src/util/lists.h
index b577c9f..9da38ae 100644
--- a/src/util/lists.h
+++ b/src/util/lists.h
@@ -146,7 +146,8 @@ do { \
#define list_empty(x) (list_magic_chkbool(x, "list_empty") && (x).next == &(x))
#define list_is_singleton(x) \
- (list_magic_chkbool(x, "list_is_singleton") && (x).next == (x).prev)
+ (list_magic_chkbool(x, "list_is_singleton") && (x).next == (x).prev \
+ && !list_empty(x))
#define list_has_prev(l,p) \
(list_magic_chkbool(l, "list_has_prev") && (p)->prev != (void *) &(l))
--
1.8.3.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/elinks.git
[email protected]:src-openeuler/elinks.git
src-openeuler
elinks
elinks
master

搜索帮助