110 Star 0 Fork 50

src-openEuler/ruby

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-CVE-2019-16162.patch 1.23 KB
一键复制 编辑 原始数据 按行查看 历史
From d4cf99d30bd5f6a8a4ababd0b9d7b06f3a479a24 Mon Sep 17 00:00:00 2001
From: "K.Takata" <kentkt@csc.jp>
Date: Thu, 1 Aug 2019 21:27:51 +0900
Subject: [PATCH] Fix out-of-bounds read in parse_char_class() (Close #139)
/[\x{111111}]/ causes out-of-bounds read when encoding is a single byte
encoding. \x{111111} is an invalid codepoint for a single byte encoding.
Check if it is a valid codepoint.
---
regenc.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff -Naur a/regenc.c b/regenc.c
--- a/regenc.c 2020-10-20 14:19:32.284000000 +0800
+++ b/regenc.c 2020-10-20 14:22:55.412000000 +0800
@@ -625,18 +625,23 @@
}
extern int
-onigenc_single_byte_code_to_mbclen(OnigCodePoint code ARG_UNUSED, OnigEncoding enc ARG_UNUSED)
+onigenc_single_byte_code_to_mbclen(OnigCodePoint code, OnigEncoding enc ARG_UNUSED)
{
+ if (code > 0xff)
+ return ONIGERR_INVALID_CODE_POINT_VALUE;
return 1;
}
extern int
onigenc_single_byte_code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc ARG_UNUSED)
{
+ if (code > 0xff) {
#ifdef RUBY
- if (code > 0xff)
rb_raise(rb_eRangeError, "%u out of char range", code);
+#else
+ return ONIGERR_INVALID_CODE_POINT_VALUE;
#endif
+ }
*buf = (UChar )(code & 0xff);
return 1;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/ruby.git
git@gitee.com:src-openeuler/ruby.git
src-openeuler
ruby
ruby
openEuler-22.03-LTS-SP4

搜索帮助