Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
080a0eb7
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看板
提交
080a0eb7
编写于
4月 28, 2011
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add _hb_unsigned_int_mul_overflows
上级
1d39d6e4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
12 addition
and
8 deletion
+12
-8
src/hb-buffer.cc
src/hb-buffer.cc
+2
-5
src/hb-open-type-private.hh
src/hb-open-type-private.hh
+1
-1
src/hb-ot-layout-gsub-private.hh
src/hb-ot-layout-gsub-private.hh
+1
-1
src/hb-private.hh
src/hb-private.hh
+8
-1
未找到文件。
src/hb-buffer.cc
浏览文件 @
080a0eb7
...
@@ -77,19 +77,16 @@ _hb_buffer_enlarge (hb_buffer_t *buffer, unsigned int size)
...
@@ -77,19 +77,16 @@ _hb_buffer_enlarge (hb_buffer_t *buffer, unsigned int size)
unsigned
int
new_allocated
=
buffer
->
allocated
;
unsigned
int
new_allocated
=
buffer
->
allocated
;
hb_glyph_position_t
*
new_pos
=
NULL
;
hb_glyph_position_t
*
new_pos
=
NULL
;
hb_glyph_info_t
*
new_info
=
NULL
;
hb_glyph_info_t
*
new_info
=
NULL
;
bool
overflows
=
FALSE
;
bool
separate_out
=
buffer
->
out_info
!=
buffer
->
info
;
bool
separate_out
=
buffer
->
out_info
!=
buffer
->
info
;
overflows
=
size
>=
((
unsigned
int
)
-
1
)
/
sizeof
(
buffer
->
info
[
0
]);
if
(
unlikely
(
_hb_unsigned_int_mul_overflows
(
size
,
sizeof
(
buffer
->
info
[
0
]))))
if
(
unlikely
(
overflows
))
goto
done
;
goto
done
;
while
(
size
>
new_allocated
)
while
(
size
>
new_allocated
)
new_allocated
+=
(
new_allocated
>>
1
)
+
32
;
new_allocated
+=
(
new_allocated
>>
1
)
+
32
;
ASSERT_STATIC
(
sizeof
(
buffer
->
info
[
0
])
==
sizeof
(
buffer
->
pos
[
0
]));
ASSERT_STATIC
(
sizeof
(
buffer
->
info
[
0
])
==
sizeof
(
buffer
->
pos
[
0
]));
overflows
=
new_allocated
>=
((
unsigned
int
)
-
1
)
/
sizeof
(
buffer
->
info
[
0
]);
if
(
unlikely
(
_hb_unsigned_int_mul_overflows
(
new_allocated
,
sizeof
(
buffer
->
info
[
0
]))))
if
(
unlikely
(
overflows
))
goto
done
;
goto
done
;
new_pos
=
(
hb_glyph_position_t
*
)
realloc
(
buffer
->
pos
,
new_allocated
*
sizeof
(
buffer
->
pos
[
0
]));
new_pos
=
(
hb_glyph_position_t
*
)
realloc
(
buffer
->
pos
,
new_allocated
*
sizeof
(
buffer
->
pos
[
0
]));
...
...
src/hb-open-type-private.hh
浏览文件 @
080a0eb7
...
@@ -231,7 +231,7 @@ struct hb_sanitize_context_t
...
@@ -231,7 +231,7 @@ struct hb_sanitize_context_t
inline
bool
check_array
(
const
void
*
base
,
unsigned
int
record_size
,
unsigned
int
len
)
const
inline
bool
check_array
(
const
void
*
base
,
unsigned
int
record_size
,
unsigned
int
len
)
const
{
{
const
char
*
p
=
(
const
char
*
)
base
;
const
char
*
p
=
(
const
char
*
)
base
;
bool
overflows
=
record_size
>
0
&&
len
>=
((
unsigned
int
)
-
1
)
/
record_size
;
bool
overflows
=
_hb_unsigned_int_mul_overflows
(
len
,
record_size
)
;
(
void
)
(
HB_DEBUG_SANITIZE
&&
(
int
)
this
->
debug_depth
<
(
int
)
HB_DEBUG_SANITIZE
&&
(
void
)
(
HB_DEBUG_SANITIZE
&&
(
int
)
this
->
debug_depth
<
(
int
)
HB_DEBUG_SANITIZE
&&
fprintf
(
stderr
,
"SANITIZE(%p) %-*d-> array [%p..%p] (%d*%d=%ld bytes) in [%p..%p] -> %s
\n
"
,
fprintf
(
stderr
,
"SANITIZE(%p) %-*d-> array [%p..%p] (%d*%d=%ld bytes) in [%p..%p] -> %s
\n
"
,
...
...
src/hb-ot-layout-gsub-private.hh
浏览文件 @
080a0eb7
...
@@ -409,7 +409,7 @@ struct Ligature
...
@@ -409,7 +409,7 @@ struct Ligature
inline
uint16_t
allocate_lig_id
(
hb_buffer_t
*
buffer
)
const
{
inline
uint16_t
allocate_lig_id
(
hb_buffer_t
*
buffer
)
const
{
uint16_t
lig_id
=
buffer
->
next_serial
();
uint16_t
lig_id
=
buffer
->
next_serial
();
if
(
unlikely
(
!
lig_id
))
lig_id
=
buffer
->
next_serial
();
/* in case of overflow
s
*/
if
(
unlikely
(
!
lig_id
))
lig_id
=
buffer
->
next_serial
();
/* in case of overflow */
return
lig_id
;
return
lig_id
;
}
}
...
...
src/hb-private.hh
浏览文件 @
080a0eb7
...
@@ -210,6 +210,13 @@ _hb_ctz (unsigned int number)
...
@@ -210,6 +210,13 @@ _hb_ctz (unsigned int number)
#endif
#endif
}
}
static
inline
bool
_hb_unsigned_int_mul_overflows
(
unsigned
int
count
,
unsigned
int
size
)
{
return
(
size
>
0
)
&&
(
count
>=
((
unsigned
int
)
-
1
)
/
size
);
}
/* Type of bsearch() / qsort() compare function */
/* Type of bsearch() / qsort() compare function */
typedef
int
(
*
hb_compare_func_t
)
(
const
void
*
,
const
void
*
);
typedef
int
(
*
hb_compare_func_t
)
(
const
void
*
,
const
void
*
);
...
@@ -297,7 +304,7 @@ struct hb_static_array_t {
...
@@ -297,7 +304,7 @@ struct hb_static_array_t {
array
=
new_array
;
array
=
new_array
;
}
}
}
else
{
}
else
{
bool
overflows
=
(
new_allocated
<
allocated
)
||
(
new_allocated
>=
((
unsigned
int
)
-
1
)
/
sizeof
(
Type
));
bool
overflows
=
(
new_allocated
<
allocated
)
||
_hb_unsigned_int_mul_overflows
(
new_allocated
,
sizeof
(
Type
));
if
(
unlikely
(
overflows
))
if
(
unlikely
(
overflows
))
new_array
=
NULL
;
new_array
=
NULL
;
else
else
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录