Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
815a73e4
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
大约 1 年 前同步成功
通知
0
Star
18
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Harfbuzz
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
815a73e4
编写于
8月 14, 2009
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[HB] Fix possible int overflows during sanitize
上级
ae728e51
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
8 deletion
+30
-8
src/TODO
src/TODO
+0
-1
src/hb-open-type-private.hh
src/hb-open-type-private.hh
+22
-0
src/hb-ot-layout-gpos-private.hh
src/hb-ot-layout-gpos-private.hh
+8
-7
未找到文件。
src/TODO
浏览文件 @
815a73e4
...
...
@@ -3,4 +3,3 @@
- cmap14 support in get_glyph callback
- size_t?
- Figure out compiler selection (add test for link to libstdc++)
- Audit sanitize for int overflows
src/hb-open-type-private.hh
浏览文件 @
815a73e4
...
...
@@ -195,6 +195,26 @@ _hb_sanitize_check (SANITIZE_ARG_DEF,
return
ret
;
}
static
HB_GNUC_UNUSED
inline
bool
_hb_sanitize_array
(
SANITIZE_ARG_DEF
,
const
char
*
base
,
unsigned
int
record_size
,
unsigned
int
len
)
{
bool
overflows
=
len
>=
((
unsigned
int
)
-
1
)
/
record_size
;
#if HB_DEBUG
if
(
sanitize_depth
<
HB_DEBUG
)
\
fprintf
(
stderr
,
"SANITIZE(%p) %-*d-> array [%p..%p] (%d*%d=%ld bytes) in [%p..%p] -> %s
\n
"
,
\
base
,
sanitize_depth
,
sanitize_depth
,
base
,
base
+
(
record_size
*
len
),
record_size
,
len
,
(
unsigned
long
)
record_size
*
len
,
context
->
start
,
context
->
end
,
!
overflows
?
"does not overflow"
:
"OVERFLOWS FAIL"
);
#endif
return
HB_LIKELY
(
!
overflows
)
&&
_hb_sanitize_check
(
SANITIZE_ARG
,
base
,
record_size
*
len
);
}
static
HB_GNUC_UNUSED
inline
bool
_hb_sanitize_edit
(
SANITIZE_ARG_DEF
,
const
char
*
base
HB_GNUC_UNUSED
,
...
...
@@ -232,6 +252,8 @@ _hb_sanitize_edit (SANITIZE_ARG_DEF,
/* TODO Optimize this if L is fixed (gcc magic) */
#define SANITIZE_MEM(B,L) HB_LIKELY (_hb_sanitize_check (SANITIZE_ARG, CONST_CHARP(B), (L)))
#define SANITIZE_ARRAY(A,S,L) HB_LIKELY (_hb_sanitize_array (SANITIZE_ARG, CONST_CHARP(A), S, L))
#define NEUTER(Var, Val) \
(SANITIZE_OBJ (Var) && \
_hb_sanitize_edit (SANITIZE_ARG, CONST_CHARP(&(Var)), sizeof (Var)) && \
...
...
src/hb-ot-layout-gpos-private.hh
浏览文件 @
815a73e4
...
...
@@ -561,11 +561,12 @@ struct PairPosFormat2
inline
bool
sanitize
(
SANITIZE_ARG_DEF
)
{
SANITIZE_DEBUG
();
return
SANITIZE_SELF
()
&&
SANITIZE_THIS
(
coverage
)
&&
SANITIZE_THIS2
(
classDef1
,
classDef2
)
&&
SANITIZE_MEM
(
values
,
(
valueFormat1
.
get_size
()
+
valueFormat2
.
get_size
())
*
class1Count
*
class2Count
);
/* XXX overflow (in other places too) */
if
(
!
(
SANITIZE_SELF
()
&&
SANITIZE_THIS
(
coverage
)
&&
SANITIZE_THIS2
(
classDef1
,
classDef2
)))
return
false
;
unsigned
int
record_size
=
valueFormat1
.
get_size
()
+
valueFormat2
.
get_size
();
unsigned
int
len
=
class1Count
*
class2Count
;
return
SANITIZE_ARRAY
(
values
,
record_size
,
len
);
}
private:
...
...
@@ -883,7 +884,7 @@ struct BaseArray
SANITIZE_DEBUG
();
if
(
!
SANITIZE_SELF
())
return
false
;
unsigned
int
count
=
cols
*
len
;
if
(
!
SANITIZE_
MEM
(
matrix
,
sizeof
(
matrix
[
0
])
*
count
))
return
false
;
if
(
!
SANITIZE_
ARRAY
(
matrix
,
sizeof
(
matrix
[
0
]),
count
))
return
false
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
!
SANITIZE_THIS
(
matrix
[
i
]))
return
false
;
return
true
;
...
...
@@ -1175,7 +1176,7 @@ struct Mark2Array
SANITIZE_DEBUG
();
if
(
!
SANITIZE_SELF
())
return
false
;
unsigned
int
count
=
cols
*
len
;
if
(
!
SANITIZE_
MEM
(
matrix
,
sizeof
(
matrix
[
0
])
*
count
))
return
false
;
if
(
!
SANITIZE_
ARRAY
(
matrix
,
sizeof
(
matrix
[
0
]),
count
))
return
false
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
!
SANITIZE_THIS
(
matrix
[
i
]))
return
false
;
return
true
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录