12 Star 0 Fork 12

src-openEuler/libical

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
libical-bugfix-timeout-found-by-fuzzer.patch 1.30 KB
一键复制 编辑 原始数据 按行查看 历史
orange-snn 提交于 2020-03-10 17:14 . bugfix in oss-fuzz
From 3eacf85ec9dd638c2023c89c2a6cdf61107fc617 Mon Sep 17 00:00:00 2001
From: Kent Sutherland <git@ksuther.com>
Date: Fri, 14 Jun 2019 15:21:59 -0500
Subject: [PATCH] Fix timeout found by fuzzer (oss-fuzz issue 14881) strspn is
really slow compared to doing direct comparisons
---
src/libical/icalparser.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/libical/icalparser.c b/src/libical/icalparser.c
index fa92495..0530a4b 100644
--- a/src/libical/icalparser.c
+++ b/src/libical/icalparser.c
@@ -221,21 +221,29 @@ static void parser_decode_param_value(char *value)
char *in, *out;
for (in = out = value; *in; in++, out++) {
- if (*in == '^' && strspn(in+1, "n^'")) {
- switch (*++in) {
- case 'n':
+ int found_escaped_char = 0;
+
+ if(*in == '^'){
+ switch (*(in + 1)) {
+ case 'n':
*out = '\n';
+ found_escaped_char = 1;
break;
-
case '^':
*out = '^';
+ found_escaped_char = 1;
break;
case '\'':
*out = '"';
+ found_escaped_char = 1;
break;
}
- } else {
+ }
+
+ if(found_escaped_char) {
+ ++in;
+ } else {
*out = *in;
}
}
--
2.19.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/libical.git
git@gitee.com:src-openeuler/libical.git
src-openeuler
libical
libical
master

搜索帮助