Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
4fa1c670
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看板
提交
4fa1c670
编写于
4月 19, 2018
作者:
G
Garret Rieger
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[subset] Check instruction offsets in glyph to ensure they are in bounds.
上级
3c976145
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
47 addition
and
2 deletion
+47
-2
src/hb-ot-glyf-table.hh
src/hb-ot-glyf-table.hh
+16
-2
test/api/fonts/oom-ccc61c92d589f895174cdef6ff2e3b20e9999a1a
test/api/fonts/oom-ccc61c92d589f895174cdef6ff2e3b20e9999a1a
+0
-0
test/api/test-subset-glyf.c
test/api/test-subset-glyf.c
+31
-0
未找到文件。
src/hb-ot-glyf-table.hh
浏览文件 @
4fa1c670
...
...
@@ -433,9 +433,23 @@ struct glyf
else
{
unsigned
int
instruction_length_offset
=
start_offset
+
GlyphHeader
::
static_size
+
2
*
num_contours
;
if
(
unlikely
(
instruction_length_offset
+
2
>
end_offset
))
{
DEBUG_MSG
(
SUBSET
,
nullptr
,
"Glyph size is too short, missing field instructionLength."
);
return
false
;
}
const
HBUINT16
&
instruction_length
=
StructAtOffset
<
HBUINT16
>
(
glyf_table
,
instruction_length_offset
);
*
instruction_start
=
instruction_length_offset
+
2
;
*
instruction_end
=
*
instruction_start
+
(
uint16_t
)
instruction_length
;
unsigned
int
start
=
instruction_length_offset
+
2
;
unsigned
int
end
=
start
+
(
uint16_t
)
instruction_length
;
if
(
unlikely
(
end
>
end_offset
))
// Out of bounds of the current glyph
{
DEBUG_MSG
(
SUBSET
,
nullptr
,
"The instructions array overruns the glyph's boundaries."
);
return
false
;
}
*
instruction_start
=
start
;
*
instruction_end
=
end
;
}
return
true
;
}
...
...
test/api/fonts/oom-ccc61c92d589f895174cdef6ff2e3b20e9999a1a
0 → 100644
浏览文件 @
4fa1c670
文件已添加
test/api/test-subset-glyf.c
浏览文件 @
4fa1c670
...
...
@@ -171,6 +171,36 @@ test_subset_glyf_strip_hints_composite (void)
hb_face_destroy
(
face_components
);
}
static
void
test_subset_glyf_strip_hints_invalid
(
void
)
{
hb_face_t
*
face
=
hb_subset_test_open_font
(
"fonts/oom-ccc61c92d589f895174cdef6ff2e3b20e9999a1a"
);
hb_set_t
*
codepoints
=
hb_set_create
();
const
hb_codepoint_t
text
[]
=
{
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'X'
,
'Y'
,
'Z'
,
'1'
,
'2'
,
'3'
,
'@'
,
'_'
,
'%'
,
'&'
,
')'
,
'*'
,
'$'
,
'!'
};
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
text
)
/
sizeof
(
hb_codepoint_t
);
i
++
)
{
hb_set_add
(
codepoints
,
text
[
i
]);
// hb_set_add (codepoints_drop_hints, text[i]);
}
hb_subset_input_t
*
input
=
hb_subset_test_create_input
(
codepoints
);
*
hb_subset_input_drop_hints
(
input
)
=
true
;
hb_set_destroy
(
codepoints
);
hb_face_t
*
face_subset
=
hb_subset_test_create_subset
(
face
,
input
);
g_assert
(
face_subset
);
g_assert
(
face_subset
==
hb_face_get_empty
());
hb_face_destroy
(
face_subset
);
hb_face_destroy
(
face
);
}
// TODO(grieger): test for long loca generation.
int
...
...
@@ -182,6 +212,7 @@ main (int argc, char **argv)
hb_test_add
(
test_subset_glyf
);
hb_test_add
(
test_subset_glyf_strip_hints_simple
);
hb_test_add
(
test_subset_glyf_strip_hints_composite
);
hb_test_add
(
test_subset_glyf_strip_hints_invalid
);
hb_test_add
(
test_subset_glyf_with_components
);
return
hb_test_run
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录