Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Turbo码先生
redis
提交
a66298e6
R
redis
项目概览
Turbo码先生
/
redis
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
a66298e6
编写于
6月 12, 2020
作者:
S
Salvatore Sanfilippo
提交者:
GitHub
6月 12, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7375 from hwware/lcs_crash_fix
Fix Server Crash in LCS Command
上级
ca58198a
7008a0ba
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
8 deletion
+14
-8
src/t_string.c
src/t_string.c
+14
-8
未找到文件。
src/t_string.c
浏览文件 @
a66298e6
...
...
@@ -516,13 +516,13 @@ void stralgoLCS(client *c) {
withmatchlen
=
1
;
}
else
if
(
!
strcasecmp
(
opt
,
"MINMATCHLEN"
)
&&
moreargs
)
{
if
(
getLongLongFromObjectOrReply
(
c
,
c
->
argv
[
j
+
1
],
&
minmatchlen
,
NULL
)
!=
C_OK
)
return
;
!=
C_OK
)
goto
clean_up_obj
;
if
(
minmatchlen
<
0
)
minmatchlen
=
0
;
j
++
;
}
else
if
(
!
strcasecmp
(
opt
,
"STRINGS"
)
&&
moreargs
>
1
)
{
if
(
a
!=
NULL
)
{
addReplyError
(
c
,
"Either use STRINGS or KEYS"
);
return
;
goto
clean_up_obj
;
}
a
=
c
->
argv
[
j
+
1
]
->
ptr
;
b
=
c
->
argv
[
j
+
2
]
->
ptr
;
...
...
@@ -530,10 +530,14 @@ void stralgoLCS(client *c) {
}
else
if
(
!
strcasecmp
(
opt
,
"KEYS"
)
&&
moreargs
>
1
)
{
if
(
a
!=
NULL
)
{
addReplyError
(
c
,
"Either use STRINGS or KEYS"
);
return
;
goto
clean_up_obj
;
}
obja
=
lookupKeyRead
(
c
->
db
,
c
->
argv
[
j
+
1
]);
objb
=
lookupKeyRead
(
c
->
db
,
c
->
argv
[
j
+
2
]);
if
(
!
(
obja
->
type
==
OBJ_STRING
)
||
!
(
objb
->
type
==
OBJ_STRING
)
)
{
addReplyError
(
c
,
"Object associate with KEYS option should only be string type"
);
goto
clean_up_obj
;
}
obja
=
obja
?
getDecodedObject
(
obja
)
:
createStringObject
(
""
,
0
);
objb
=
objb
?
getDecodedObject
(
objb
)
:
createStringObject
(
""
,
0
);
a
=
obja
->
ptr
;
...
...
@@ -541,7 +545,7 @@ void stralgoLCS(client *c) {
j
+=
2
;
}
else
{
addReply
(
c
,
shared
.
syntaxerr
);
return
;
goto
clean_up_obj
;
}
}
...
...
@@ -549,12 +553,12 @@ void stralgoLCS(client *c) {
if
(
a
==
NULL
)
{
addReplyError
(
c
,
"Please specify two strings: "
"STRINGS or KEYS options are mandatory"
);
return
;
goto
clean_up_obj
;
}
else
if
(
getlen
&&
getidx
)
{
addReplyError
(
c
,
"If you want both the length and indexes, please "
"just use IDX."
);
return
;
goto
clean_up_obj
;
}
/* Compute the LCS using the vanilla dynamic programming technique of
...
...
@@ -689,10 +693,12 @@ void stralgoLCS(client *c) {
}
/* Cleanup. */
if
(
obja
)
decrRefCount
(
obja
);
if
(
objb
)
decrRefCount
(
objb
);
sdsfree
(
result
);
zfree
(
lcs
);
clean_up_obj:
if
(
obja
)
decrRefCount
(
obja
);
if
(
objb
)
decrRefCount
(
objb
);
return
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录