Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
3531efdb
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,发现更多精彩内容 >>
提交
3531efdb
编写于
3月 20, 2018
作者:
G
Garret Rieger
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[subset] Fixed out of bounds read when subsetting hdmx.
上级
e597436b
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
47 addition
and
6 deletion
+47
-6
src/hb-ot-hdmx-table.hh
src/hb-ot-hdmx-table.hh
+24
-6
test/api/fonts/crash-ccc61c92d589f895174cdef6ff2e3b20e9999a1a
.../api/fonts/crash-ccc61c92d589f895174cdef6ff2e3b20e9999a1a
+0
-0
test/api/test-subset-hdmx.c
test/api/test-subset-hdmx.c
+23
-0
未找到文件。
src/hb-ot-hdmx-table.hh
浏览文件 @
3531efdb
...
...
@@ -43,12 +43,15 @@ struct DeviceRecord
struct
SubsetView
{
const
DeviceRecord
*
source_device_record
;
unsigned
int
size_device_record
;
hb_subset_plan_t
*
subset_plan
;
inline
void
init
(
const
DeviceRecord
*
source_device_record
,
unsigned
int
size_device_record
,
hb_subset_plan_t
*
subset_plan
)
{
this
->
source_device_record
=
source_device_record
;
this
->
size_device_record
=
size_device_record
;
this
->
subset_plan
=
subset_plan
;
}
...
...
@@ -57,11 +60,17 @@ struct DeviceRecord
return
this
->
subset_plan
->
gids_to_retain_sorted
.
len
;
}
inline
const
HBUINT8
&
operator
[]
(
unsigned
int
i
)
const
inline
const
HBUINT8
*
operator
[]
(
unsigned
int
i
)
const
{
if
(
unlikely
(
i
>=
len
()))
return
Null
(
HBUINT8
)
;
if
(
unlikely
(
i
>=
len
()))
return
nullptr
;
hb_codepoint_t
gid
=
this
->
subset_plan
->
gids_to_retain_sorted
[
i
];
return
this
->
source_device_record
->
widths
[
gid
];
const
HBUINT8
*
width
=
&
(
this
->
source_device_record
->
widths
[
gid
]);
if
(
width
<
((
const
HBUINT8
*
)
this
->
source_device_record
)
+
size_device_record
)
return
width
;
else
return
nullptr
;
}
};
...
...
@@ -85,7 +94,15 @@ struct DeviceRecord
this
->
max_width
.
set
(
subset_view
.
source_device_record
->
max_width
);
for
(
unsigned
int
i
=
0
;
i
<
subset_view
.
len
();
i
++
)
widths
[
i
].
set
(
subset_view
[
i
]);
{
const
HBUINT8
*
width
=
subset_view
[
i
];
if
(
!
width
)
{
DEBUG_MSG
(
SUBSET
,
nullptr
,
"HDMX width for new gid %d is missing."
,
i
);
return_trace
(
false
);
}
widths
[
i
].
set
(
*
width
);
}
return_trace
(
true
);
}
...
...
@@ -133,9 +150,10 @@ struct hdmx
for
(
unsigned
int
i
=
0
;
i
<
source_hdmx
->
num_records
;
i
++
)
{
DeviceRecord
::
SubsetView
subset_view
;
subset_view
.
init
(
&
(
*
source_hdmx
)[
i
],
plan
);
subset_view
.
init
(
&
(
*
source_hdmx
)[
i
],
source_hdmx
->
size_device_record
,
plan
);
c
->
start_embed
<
DeviceRecord
>
()
->
serialize
(
c
,
subset_view
);
if
(
!
c
->
start_embed
<
DeviceRecord
>
()
->
serialize
(
c
,
subset_view
))
return_trace
(
false
);
}
return_trace
(
true
);
...
...
test/api/fonts/crash-ccc61c92d589f895174cdef6ff2e3b20e9999a1a
0 → 100644
浏览文件 @
3531efdb
文件已添加
test/api/test-subset-hdmx.c
浏览文件 @
3531efdb
...
...
@@ -50,6 +50,28 @@ test_subset_hdmx_simple_subset (void)
hb_face_destroy
(
face_ac
);
}
static
void
test_subset_hdmx_invalid
(
void
)
{
hb_face_t
*
face
=
hb_subset_test_open_font
(
"fonts/crash-ccc61c92d589f895174cdef6ff2e3b20e9999a1a"
);
hb_subset_input_t
*
input
=
hb_subset_input_create_or_fail
();
hb_set_t
*
codepoints
=
hb_subset_input_unicode_set
(
input
);
hb_set_add
(
codepoints
,
'a'
);
hb_set_add
(
codepoints
,
'b'
);
hb_set_add
(
codepoints
,
'c'
);
hb_subset_profile_t
*
profile
=
hb_subset_profile_create
();
hb_face_t
*
subset
=
hb_subset
(
face
,
profile
,
input
);
g_assert
(
subset
);
g_assert
(
subset
==
hb_face_get_empty
());
hb_subset_input_destroy
(
input
);
hb_subset_profile_destroy
(
profile
);
hb_face_destroy
(
subset
);
hb_face_destroy
(
face
);
}
static
void
test_subset_hdmx_noop
(
void
)
{
...
...
@@ -75,6 +97,7 @@ main (int argc, char **argv)
hb_test_init
(
&
argc
,
&
argv
);
hb_test_add
(
test_subset_hdmx_simple_subset
);
hb_test_add
(
test_subset_hdmx_invalid
);
hb_test_add
(
test_subset_hdmx_noop
);
return
hb_test_run
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录