Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
fa030175
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看板
提交
fa030175
编写于
4月 29, 2010
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[sanitize] Make debug code always available to the compiler
Such that we don't break debug build all the time.
上级
fde6f5bd
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
40 deletion
+31
-40
src/hb-open-type-private.hh
src/hb-open-type-private.hh
+31
-40
未找到文件。
src/hb-open-type-private.hh
浏览文件 @
fa030175
...
...
@@ -155,20 +155,18 @@ _hb_sanitize_init (hb_sanitize_context_t *context,
context
->
writable
=
hb_blob_is_writable
(
blob
);
context
->
edit_count
=
0
;
#if HB_DEBUG_SANITIZE
fprintf
(
stderr
,
"sanitize %p init [%p..%p] (%u bytes)
\n
"
,
blob
,
context
->
start
,
context
->
end
,
context
->
end
-
context
->
start
);
#endif
if
(
HB_DEBUG_SANITIZE
)
fprintf
(
stderr
,
"sanitize %p init [%p..%p] (%u bytes)
\n
"
,
blob
,
context
->
start
,
context
->
end
,
context
->
end
-
context
->
start
);
}
static
HB_GNUC_UNUSED
void
_hb_sanitize_fini
(
hb_sanitize_context_t
*
context
HB_GNUC_UNUSED
,
hb_blob_t
*
blob
)
{
#if HB_DEBUG_SANITIZE
fprintf
(
stderr
,
"sanitize %p fini [%p..%p] %u edit requests
\n
"
,
blob
,
context
->
start
,
context
->
end
,
context
->
edit_count
);
#endif
if
(
HB_DEBUG_SANITIZE
)
fprintf
(
stderr
,
"sanitize %p fini [%p..%p] %u edit requests
\n
"
,
blob
,
context
->
start
,
context
->
end
,
context
->
edit_count
);
hb_blob_unlock
(
blob
);
}
...
...
@@ -182,15 +180,14 @@ _hb_sanitize_check (SANITIZE_ARG_DEF,
base
<=
context
->
end
&&
(
unsigned
int
)
(
context
->
end
-
base
)
>=
len
;
#if HB_DEBUG_SANITIZE
if
(
sanitize_depth
<
HB_DEBUG_SANITIZE
)
\
if
(
HB_DEBUG_SANITIZE
&&
(
int
)
sanitize_depth
<
(
int
)
HB_DEBUG_SANITIZE
)
\
fprintf
(
stderr
,
"SANITIZE(%p) %-*d-> check [%p..%p] (%d bytes) in [%p..%p] -> %s
\n
"
,
\
base
,
sanitize_depth
,
sanitize_depth
,
base
,
base
+
len
,
len
,
context
->
start
,
context
->
end
,
ret
?
"pass"
:
"FAIL"
);
#endif
return
ret
;
}
...
...
@@ -202,15 +199,14 @@ _hb_sanitize_array (SANITIZE_ARG_DEF,
{
bool
overflows
=
len
>=
((
unsigned
int
)
-
1
)
/
record_size
;
#if HB_DEBUG_SANITIZE
if
(
sanitize_depth
<
HB_DEBUG_SANITIZE
)
\
if
(
HB_DEBUG_SANITIZE
&&
(
int
)
sanitize_depth
<
(
int
)
HB_DEBUG_SANITIZE
)
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
);
}
...
...
@@ -222,15 +218,14 @@ _hb_sanitize_edit (SANITIZE_ARG_DEF,
{
context
->
edit_count
++
;
#if HB_DEBUG_SANITIZE
fprintf
(
stderr
,
"SANITIZE(%p) %-*d-> edit(%u) [%p..%p] (%d bytes) in [%p..%p] -> %s
\n
"
,
\
base
,
sanitize_depth
,
sanitize_depth
,
context
->
edit_count
,
base
,
base
+
len
,
len
,
context
->
start
,
context
->
end
,
context
->
writable
?
"granted"
:
"REJECTED"
);
#endif
if
(
HB_DEBUG_SANITIZE
&&
(
int
)
sanitize_depth
<
(
int
)
HB_DEBUG_SANITIZE
)
fprintf
(
stderr
,
"SANITIZE(%p) %-*d-> edit(%u) [%p..%p] (%d bytes) in [%p..%p] -> %s
\n
"
,
\
base
,
sanitize_depth
,
sanitize_depth
,
context
->
edit_count
,
base
,
base
+
len
,
len
,
context
->
start
,
context
->
end
,
context
->
writable
?
"granted"
:
"REJECTED"
);
return
context
->
writable
;
}
...
...
@@ -270,9 +265,8 @@ struct Sanitizer
/* TODO is_sane() stuff */
retry:
#if HB_DEBUG_SANITIZE
fprintf
(
stderr
,
"Sanitizer %p start %s
\n
"
,
blob
,
__PRETTY_FUNCTION__
);
#endif
if
(
HB_DEBUG_SANITIZE
)
fprintf
(
stderr
,
"Sanitizer %p start %s
\n
"
,
blob
,
__PRETTY_FUNCTION__
);
_hb_sanitize_init
(
context
,
blob
);
...
...
@@ -281,18 +275,17 @@ struct Sanitizer
sane
=
t
->
sanitize
(
SANITIZE_ARG
);
if
(
sane
)
{
if
(
context
->
edit_count
)
{
#if HB_DEBUG_SANITIZE
fprintf
(
stderr
,
"Sanitizer %p passed first round with %d edits; doing a second round %s
\n
"
,
blob
,
context
->
edit_count
,
__PRETTY_FUNCTION__
);
#endif
if
(
HB_DEBUG_SANITIZE
)
fprintf
(
stderr
,
"Sanitizer %p passed first round with %d edits; doing a second round %s
\n
"
,
blob
,
context
->
edit_count
,
__PRETTY_FUNCTION__
);
/* sanitize again to ensure no toe-stepping */
context
->
edit_count
=
0
;
sane
=
t
->
sanitize
(
SANITIZE_ARG
);
if
(
context
->
edit_count
)
{
#if HB_DEBUG_SANITIZE
fprintf
(
stderr
,
"Sanitizer %p requested %d edits in second round; FAILLING %s
\n
"
,
blob
,
context
->
edit_count
,
__PRETTY_FUNCTION__
);
#endif
if
(
HB_DEBUG_SANITIZE
)
fprintf
(
stderr
,
"Sanitizer %p requested %d edits in second round; FAILLING %s
\n
"
,
blob
,
context
->
edit_count
,
__PRETTY_FUNCTION__
);
sane
=
false
;
}
}
...
...
@@ -302,16 +295,14 @@ struct Sanitizer
_hb_sanitize_fini
(
context
,
blob
);
if
(
edit_count
&&
!
hb_blob_is_writable
(
blob
)
&&
hb_blob_try_writable
(
blob
))
{
/* ok, we made it writable by relocating. try again */
#if HB_DEBUG_SANITIZE
fprintf
(
stderr
,
"Sanitizer %p retry %s
\n
"
,
blob
,
__PRETTY_FUNCTION__
);
#endif
if
(
HB_DEBUG_SANITIZE
)
fprintf
(
stderr
,
"Sanitizer %p retry %s
\n
"
,
blob
,
__PRETTY_FUNCTION__
);
goto
retry
;
}
}
#if HB_DEBUG_SANITIZE
fprintf
(
stderr
,
"Sanitizer %p %s %s
\n
"
,
blob
,
sane
?
"passed"
:
"FAILED"
,
__PRETTY_FUNCTION__
);
#endif
if
(
HB_DEBUG_SANITIZE
)
fprintf
(
stderr
,
"Sanitizer %p %s %s
\n
"
,
blob
,
sane
?
"passed"
:
"FAILED"
,
__PRETTY_FUNCTION__
);
if
(
sane
)
return
blob
;
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录