Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
c02b40e5
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看板
提交
c02b40e5
编写于
4月 17, 2018
作者:
G
Garret Rieger
提交者:
Behdad Esfahbod
4月 17, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[subset] add a fuzzer target for subset_get_all_codepoints method. (#987)
上级
92480316
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
64 addition
and
2 deletion
+64
-2
test/fuzzing/CMakeLists.txt
test/fuzzing/CMakeLists.txt
+6
-1
test/fuzzing/Makefile.am
test/fuzzing/Makefile.am
+16
-0
test/fuzzing/hb-subset-get-codepoints-fuzzer.cc
test/fuzzing/hb-subset-get-codepoints-fuzzer.cc
+24
-0
test/fuzzing/run-subset-fuzzer-tests.py
test/fuzzing/run-subset-fuzzer-tests.py
+18
-1
未找到文件。
test/fuzzing/CMakeLists.txt
浏览文件 @
c02b40e5
...
...
@@ -2,6 +2,7 @@ if (HB_CHECK)
file
(
READ
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/Makefile.am"
MAKEFILEAM
)
extract_make_variable
(
hb_shape_fuzzer_SOURCES
${
MAKEFILEAM
}
)
extract_make_variable
(
hb_subset_fuzzer_SOURCES
${
MAKEFILEAM
}
)
extract_make_variable
(
hb_subset_get_codepoints_fuzzer_SOURCES
${
MAKEFILEAM
}
)
# TODO: enable these two
#extract_make_variable (FUZZING_CPPFLAGS ${MAKEFILEAM}) # extracting regex fail
...
...
@@ -15,13 +16,17 @@ if (HB_CHECK)
add_executable
(
hb-subset-fuzzer
${
hb_subset_fuzzer_SOURCES
}
)
target_link_libraries
(
hb-subset-fuzzer harfbuzz-subset
)
add_executable
(
hb-subset-get-codepoints-fuzzer
${
hb_subset_get_codepoints_fuzzer_SOURCES
}
)
target_link_libraries
(
hb-subset-get-codepoints-fuzzer harfbuzz-subset
)
target_compile_definitions
(
hb-shape-fuzzer PUBLIC
${
FUZZING_CPPFLAGS
}
)
target_compile_definitions
(
hb-subset-fuzzer PUBLIC
${
FUZZING_CPPFLAGS
}
)
target_compile_definitions
(
hb-subset-get-codepoints-fuzzer PUBLIC
${
FUZZING_CPPFLAGS
}
)
add_test
(
NAME hb-shape-fuzzer
COMMAND
"
${
PYTHON_EXECUTABLE
}
"
run-shape-fuzzer-tests.py $<TARGET_FILE:hb-shape-fuzzer>
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
)
add_test
(
NAME hb-subset-fuzzer
COMMAND
"
${
PYTHON_EXECUTABLE
}
"
run-subset-fuzzer-tests.py $<TARGET_FILE:hb-subset-fuzzer>
COMMAND
"
${
PYTHON_EXECUTABLE
}
"
run-subset-fuzzer-tests.py $<TARGET_FILE:hb-subset-fuzzer>
$<TARGET_FILE:hb-subset-get-codepoints-fuzzer>
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
)
endif
()
test/fuzzing/Makefile.am
浏览文件 @
c02b40e5
...
...
@@ -23,6 +23,7 @@ EXTRA_DIST += \
check_PROGRAMS
=
\
hb-shape-fuzzer
\
hb-subset-fuzzer
\
hb-subset-get-codepoints-fuzzer
\
$(NULL)
AM_CPPFLAGS
=
\
...
...
@@ -64,6 +65,21 @@ hb_subset_fuzzer_DEPENDENCIES = \
lib
\
$(NULL)
hb_subset_get_codepoints_fuzzer_SOURCES
=
\
hb-fuzzer.hh
\
hb-subset-get-codepoints-fuzzer.cc
\
main.cc
\
$(NULL)
hb_subset_get_codepoints_fuzzer_LDADD
=
\
$(top_builddir)
/src/libharfbuzz-subset-fuzzing.la
\
$(NULL)
hb_subset_get_codepoints_fuzzer_CPPFLAGS
=
\
$(AM_CPPFLAGS)
\
$(NULL)
hb_subset_get_codepoints_fuzzer_DEPENDENCIES
=
\
lib
\
$(NULL)
check
:
EXEEXT
=
"
$(EXEEXT)
"
srcdir
=
"
$(srcdir)
"
builddir
=
"
$(builddir)
"
$(srcdir)
/run-shape-fuzzer-tests.py
EXEEXT
=
"
$(EXEEXT)
"
srcdir
=
"
$(srcdir)
"
builddir
=
"
$(builddir)
"
$(srcdir)
/run-subset-fuzzer-tests.py
...
...
test/fuzzing/hb-subset-get-codepoints-fuzzer.cc
0 → 100644
浏览文件 @
c02b40e5
#include "hb-fuzzer.hh"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "hb-subset.h"
extern
"C"
int
LLVMFuzzerTestOneInput
(
const
uint8_t
*
data
,
size_t
size
)
{
printf
(
"hb-subset-get-codepoints-fuzzer: input size = %zu
\n
"
,
size
);
hb_blob_t
*
blob
=
hb_blob_create
((
const
char
*
)
data
,
size
,
HB_MEMORY_MODE_READONLY
,
NULL
,
NULL
);
hb_face_t
*
face
=
hb_face_create
(
blob
,
0
);
hb_set_t
*
output
=
hb_set_create
();
hb_subset_get_all_codepoints
(
face
,
output
);
hb_set_destroy
(
output
);
hb_face_destroy
(
face
);
hb_blob_destroy
(
blob
);
return
0
;
}
test/fuzzing/run-subset-fuzzer-tests.py
浏览文件 @
c02b40e5
...
...
@@ -8,15 +8,24 @@ srcdir = os.environ.get ("srcdir", ".")
EXEEXT
=
os
.
environ
.
get
(
"EXEEXT"
,
""
)
top_builddir
=
os
.
environ
.
get
(
"top_builddir"
,
"."
)
hb_subset_fuzzer
=
os
.
path
.
join
(
top_builddir
,
"hb-subset-fuzzer"
+
EXEEXT
)
hb_subset_get_codepoints_fuzzer
=
os
.
path
.
join
(
top_builddir
,
"hb-subset-get-codepoints-fuzzer"
+
EXEEXT
)
if
not
os
.
path
.
exists
(
hb_subset_fuzzer
):
if
len
(
sys
.
argv
)
==
1
or
not
os
.
path
.
exists
(
sys
.
argv
[
1
]):
if
len
(
sys
.
argv
)
<
2
or
not
os
.
path
.
exists
(
sys
.
argv
[
1
]):
print
(
"""Failed to find hb-subset-fuzzer binary automatically,
please provide it as the first argument to the tool"""
)
sys
.
exit
(
1
)
hb_subset_fuzzer
=
sys
.
argv
[
1
]
if
not
os
.
path
.
exists
(
hb_subset_get_codepoints_fuzzer
):
if
len
(
sys
.
argv
)
<
3
or
not
os
.
path
.
exists
(
sys
.
argv
[
2
]):
print
(
"""Failed to find hb-subset-get-codepoints-fuzzer binary automatically,
please provide it as the second argument to the tool"""
)
sys
.
exit
(
1
)
hb_subset_get_codepoints_fuzzer
=
sys
.
argv
[
2
]
print
(
'hb_subset_fuzzer:'
,
hb_subset_fuzzer
)
fails
=
0
...
...
@@ -24,6 +33,7 @@ parent_path = os.path.join (srcdir, "..", "subset", "data", "fonts")
print
(
"running subset fuzzer against fonts in %s"
%
parent_path
)
for
file
in
os
.
listdir
(
parent_path
):
path
=
os
.
path
.
join
(
parent_path
,
file
)
print
(
"running subset fuzzer against %s"
%
path
)
p
=
subprocess
.
Popen
([
hb_subset_fuzzer
,
path
])
...
...
@@ -31,6 +41,13 @@ for file in os.listdir (parent_path):
print
(
"failed for %s"
%
path
)
fails
=
fails
+
1
print
(
"running subset get codepoints fuzzer against %s"
%
path
)
p
=
subprocess
.
Popen
([
hb_subset_get_codepoints_fuzzer
,
path
])
if
p
.
wait
()
!=
0
:
print
(
"failed for %s"
%
path
)
fails
=
fails
+
1
if
fails
:
print
(
"%i subset fuzzer related tests failed."
%
fails
)
sys
.
exit
(
1
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录