Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
d8936111
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d8936111
编写于
9月 20, 2013
作者:
S
sla
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7200277: [parfait] potential buffer overflow in npt/utf.c
Reviewed-by: dsamersoff, dcubed
上级
2f8dec5b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
15 addition
and
6 deletion
+15
-6
src/share/npt/utf.c
src/share/npt/utf.c
+15
-6
未找到文件。
src/share/npt/utf.c
浏览文件 @
d8936111
...
...
@@ -105,18 +105,24 @@ utf16ToUtf8m(struct UtfInst *ui, unsigned short *utf16, int len, jbyte *output,
code
=
utf16
[
i
];
if
(
code
>=
0x0001
&&
code
<=
0x007F
)
{
if
(
outputLen
+
1
>=
outputMaxLen
)
{
return
-
1
;
}
output
[
outputLen
++
]
=
code
;
}
else
if
(
code
==
0
||
(
code
>=
0x0080
&&
code
<=
0x07FF
)
)
{
if
(
outputLen
+
2
>=
outputMaxLen
)
{
return
-
1
;
}
output
[
outputLen
++
]
=
((
code
>>
6
)
&
0x1F
)
|
0xC0
;
output
[
outputLen
++
]
=
(
code
&
0x3F
)
|
0x80
;
}
else
if
(
code
>=
0x0800
&&
code
<=
0xFFFF
)
{
if
(
outputLen
+
3
>=
outputMaxLen
)
{
return
-
1
;
}
output
[
outputLen
++
]
=
((
code
>>
12
)
&
0x0F
)
|
0xE0
;
output
[
outputLen
++
]
=
((
code
>>
6
)
&
0x3F
)
|
0x80
;
output
[
outputLen
++
]
=
(
code
&
0x3F
)
|
0x80
;
}
if
(
outputLen
>
outputMaxLen
)
{
return
-
1
;
}
}
output
[
outputLen
]
=
0
;
return
outputLen
;
...
...
@@ -412,12 +418,15 @@ bytesToPrintable(struct UtfInst *ui, char *bytes, int len, char *output, int out
unsigned
byte
;
byte
=
bytes
[
i
];
if
(
outputLen
>=
outputMaxLen
)
{
return
-
1
;
}
if
(
byte
<=
0x7f
&&
isprint
(
byte
)
&&
!
iscntrl
(
byte
)
)
{
if
(
outputLen
+
1
>=
outputMaxLen
)
{
return
-
1
;
}
output
[
outputLen
++
]
=
(
char
)
byte
;
}
else
{
if
(
outputLen
+
4
>=
outputMaxLen
)
{
return
-
1
;
}
(
void
)
sprintf
(
output
+
outputLen
,
"
\\
x%02x"
,
byte
);
outputLen
+=
4
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录