Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
cf26e88a
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看板
提交
cf26e88a
编写于
5月 11, 2012
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Finish off debug output beautification
上级
d7bba01a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
26 addition
and
32 deletion
+26
-32
src/hb-open-type-private.hh
src/hb-open-type-private.hh
+26
-32
未找到文件。
src/hb-open-type-private.hh
浏览文件 @
cf26e88a
...
...
@@ -166,7 +166,7 @@ struct hb_sanitize_context_t
this
->
writable
=
false
;
}
inline
void
s
etup
(
void
)
inline
void
s
tart_processing
(
void
)
{
this
->
start
=
hb_blob_get_data
(
this
->
blob
,
NULL
);
this
->
end
=
this
->
start
+
hb_blob_get_length
(
this
->
blob
);
...
...
@@ -174,15 +174,15 @@ struct hb_sanitize_context_t
this
->
debug_depth
=
0
;
DEBUG_MSG_LEVEL
(
SANITIZE
,
this
->
blob
,
0
,
+
1
,
"
ini
t [%p..%p] (%lu bytes)"
,
"
star
t [%p..%p] (%lu bytes)"
,
this
->
start
,
this
->
end
,
(
unsigned
long
)
(
this
->
end
-
this
->
start
));
}
inline
void
finish
(
void
)
inline
void
end_processing
(
void
)
{
DEBUG_MSG_LEVEL
(
SANITIZE
,
this
->
blob
,
0
,
-
1
,
"
fini
[%p..%p] %u edit requests"
,
"
end
[%p..%p] %u edit requests"
,
this
->
start
,
this
->
end
,
this
->
edit_count
);
hb_blob_destroy
(
this
->
blob
);
...
...
@@ -193,17 +193,13 @@ struct hb_sanitize_context_t
inline
bool
check_range
(
const
void
*
base
,
unsigned
int
len
)
const
{
const
char
*
p
=
(
const
char
*
)
base
;
bool
ret
=
this
->
start
<=
p
&&
p
<=
this
->
end
&&
(
unsigned
int
)
(
this
->
end
-
p
)
>=
len
;
DEBUG_MSG_LEVEL
(
SANITIZE
,
this
->
blob
,
this
->
debug_depth
+
1
,
0
,
"range [%p..%p] (%d bytes) in [%p..%p] -> %s"
,
p
,
p
+
len
,
len
,
this
->
start
,
this
->
end
,
ret
?
"pass"
:
"FAIL"
);
hb_auto_trace_t
<
HB_DEBUG_SANITIZE
>
trace
(
&
this
->
debug_depth
,
"SANITIZE"
,
this
->
blob
,
NULL
,
"check_range [%p..%p] (%d bytes) in [%p..%p]"
,
p
,
p
+
len
,
len
,
this
->
start
,
this
->
end
);
return
likely
(
ret
);
return
TRACE_RETURN
(
likely
(
this
->
start
<=
p
&&
p
<=
this
->
end
&&
(
unsigned
int
)
(
this
->
end
-
p
)
>=
len
)
);
}
inline
bool
check_array
(
const
void
*
base
,
unsigned
int
record_size
,
unsigned
int
len
)
const
...
...
@@ -211,13 +207,12 @@ struct hb_sanitize_context_t
const
char
*
p
=
(
const
char
*
)
base
;
bool
overflows
=
_hb_unsigned_int_mul_overflows
(
len
,
record_size
);
DEBUG_MSG_LEVEL
(
SANITIZE
,
this
->
blob
,
this
->
debug_depth
+
1
,
0
,
"array [%p..%p] (%d*%d=%ld bytes) in [%p..%p] -> %s"
,
p
,
p
+
(
record_size
*
len
),
record_size
,
len
,
(
unsigned
long
)
record_size
*
len
,
this
->
start
,
this
->
end
,
!
overflows
?
"does not overflow"
:
"OVERFLOWS FAIL"
);
hb_auto_trace_t
<
HB_DEBUG_SANITIZE
>
trace
(
&
this
->
debug_depth
,
"SANITIZE"
,
this
->
blob
,
NULL
,
"check_array [%p..%p] (%d*%d=%ld bytes) in [%p..%p]"
,
p
,
p
+
(
record_size
*
len
),
record_size
,
len
,
(
unsigned
long
)
record_size
*
len
,
this
->
start
,
this
->
end
);
return
likely
(
!
overflows
&&
this
->
check_range
(
base
,
record_size
*
len
));
return
TRACE_RETURN
(
likely
(
!
overflows
&&
this
->
check_range
(
base
,
record_size
*
len
)
));
}
template
<
typename
Type
>
...
...
@@ -226,22 +221,21 @@ struct hb_sanitize_context_t
return
likely
(
this
->
check_range
(
obj
,
obj
->
min_size
));
}
inline
bool
can
_edit
(
const
void
*
base
HB_UNUSED
,
unsigned
int
len
HB_UNUSED
)
inline
bool
may
_edit
(
const
void
*
base
HB_UNUSED
,
unsigned
int
len
HB_UNUSED
)
{
const
char
*
p
=
(
const
char
*
)
base
;
this
->
edit_count
++
;
DEBUG_MSG_LEVEL
(
SANITIZE
,
this
->
blob
,
this
->
debug_depth
+
1
,
0
,
"edit(%u) [%p..%p] (%d bytes) in [%p..%p] -> %s"
,
this
->
edit_count
,
p
,
p
+
len
,
len
,
this
->
start
,
this
->
end
,
this
->
writable
?
"granted"
:
"REJECTED"
);
hb_auto_trace_t
<
HB_DEBUG_SANITIZE
>
trace
(
&
this
->
debug_depth
,
"SANITIZE"
,
this
->
blob
,
NULL
,
"may_edit(%u) [%p..%p] (%d bytes) in [%p..%p] -> %s"
,
this
->
edit_count
,
p
,
p
+
len
,
len
,
this
->
start
,
this
->
end
);
return
this
->
writable
;
return
TRACE_RETURN
(
this
->
writable
)
;
}
unsigned
int
debug_depth
;
mutable
unsigned
int
debug_depth
;
const
char
*
start
,
*
end
;
bool
writable
;
unsigned
int
edit_count
;
...
...
@@ -265,10 +259,10 @@ struct Sanitizer
retry:
DEBUG_MSG_FUNC
(
SANITIZE
,
blob
,
"start"
);
c
->
s
etup
();
c
->
s
tart_processing
();
if
(
unlikely
(
!
c
->
start
))
{
c
->
finish
();
c
->
end_processing
();
return
blob
;
}
...
...
@@ -302,7 +296,7 @@ struct Sanitizer
}
}
c
->
finish
();
c
->
end_processing
();
DEBUG_MSG_FUNC
(
SANITIZE
,
blob
,
sane
?
"PASSED"
:
"FAILED"
);
if
(
sane
)
...
...
@@ -514,7 +508,7 @@ struct GenericOffsetTo : OffsetType
private:
/* Set the offset to Null */
inline
bool
neuter
(
hb_sanitize_context_t
*
c
)
{
if
(
c
->
can
_edit
(
this
,
this
->
static_size
))
{
if
(
c
->
may
_edit
(
this
,
this
->
static_size
))
{
this
->
set
(
0
);
/* 0 is Null offset */
return
true
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录