Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
b97b310d
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
b97b310d
编写于
5月 26, 2022
作者:
O
openharmony_ci
提交者:
Gitee
5月 26, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3303 libz strcpy 改为strcpy_s
Merge pull request !3303 from dujingcheng/beta32
上级
28c954c7
63eb2494
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
20 addition
and
17 deletion
+20
-17
appexecfwk/zlib/actszlibtest/ActsZlibTest.cpp
appexecfwk/zlib/actszlibtest/ActsZlibTest.cpp
+19
-17
appexecfwk/zlib/actszlibtest/BUILD.gn
appexecfwk/zlib/actszlibtest/BUILD.gn
+1
-0
未找到文件。
appexecfwk/zlib/actszlibtest/ActsZlibTest.cpp
浏览文件 @
b97b310d
...
...
@@ -18,6 +18,7 @@
#include <cstdlib>
#include <fstream>
#include <gtest/gtest.h>
#include <securec.h>
#include <sstream>
#include <string>
...
...
@@ -35,6 +36,7 @@ static int ONE = 1;
static
int
FOUR
=
4
;
static
int
SIX
=
6
;
static
int
EIGHT
=
8
;
static
int
GARBAGE_LEN
=
strlen
(
GARBAGE
);
static
unsigned
BUFFER_SIZE
=
8192
;
}
...
...
@@ -125,7 +127,7 @@ HWTEST_F(ActsZlibTest, ActsZlibTestCompress, Function | MediumTest | Level2)
fprintf
(
stderr
,
"compress error: %d
\n
"
,
err
);
ASSERT_EQ
(
err
,
Z_OK
);
strcpy
(
reinterpret_cast
<
char
*>
(
uncompr
)
,
GARBAGE
);
strcpy
_s
(
reinterpret_cast
<
char
*>
(
uncompr
),
GARBAGE_LEN
,
GARBAGE
);
err
=
uncompress
(
uncompr
,
&
uncomprLen
,
compr
,
comprLen
);
fprintf
(
stderr
,
"uncompress error: %d
\n
"
,
err
);
ASSERT_EQ
(
err
,
Z_OK
);
...
...
@@ -171,7 +173,7 @@ HWTEST_F(ActsZlibTest, ActsZlibTestGzio, Function | MediumTest | Level2)
uncompr
=
static_cast
<
Byte
*>
(
calloc
(
static_cast
<
uInt
>
(
uncomprLen
),
CALLOC_SIZE
));
ASSERT_TRUE
(
compr
!=
Z_NULL
&&
uncompr
!=
Z_NULL
);
strcpy
(
reinterpret_cast
<
char
*>
(
uncompr
)
,
GARBAGE
);
strcpy
_s
(
reinterpret_cast
<
char
*>
(
uncompr
),
GARBAGE_LEN
,
GARBAGE
);
ASSERT_TRUE
(
gzread
(
file
,
uncompr
,
static_cast
<
unsigned
>
(
uncomprLen
))
==
len
);
ASSERT_FALSE
(
strcmp
(
reinterpret_cast
<
char
*>
(
uncompr
),
HELLO
));
...
...
@@ -253,7 +255,7 @@ HWTEST_F(ActsZlibTest, ActsZlibTestInflate, Function | MediumTest | Level2)
int
err
=
Z_OK
;
z_stream
d_stream
;
/* decompression stream */
strcpy
(
reinterpret_cast
<
char
*>
(
uncompr
)
,
GARBAGE
);
strcpy
_s
(
reinterpret_cast
<
char
*>
(
uncompr
),
GARBAGE_LEN
,
GARBAGE
);
d_stream
.
zalloc
=
nullptr
;
d_stream
.
zfree
=
nullptr
;
d_stream
.
opaque
=
nullptr
;
...
...
@@ -356,7 +358,7 @@ HWTEST_F(ActsZlibTest, ActsZlibTestLargeInflate, Function | MediumTest | Level2)
int
err
=
Z_OK
;
z_stream
d_stream
;
/* decompression stream */
strcpy
(
reinterpret_cast
<
char
*>
(
uncompr
)
,
GARBAGE
);
strcpy
_s
(
reinterpret_cast
<
char
*>
(
uncompr
),
GARBAGE_LEN
,
GARBAGE
);
d_stream
.
zalloc
=
nullptr
;
d_stream
.
zfree
=
nullptr
;
d_stream
.
opaque
=
nullptr
;
...
...
@@ -438,7 +440,7 @@ HWTEST_F(ActsZlibTest, ActsZlibTestSync, Function | MediumTest | Level2)
int
err
=
Z_OK
;
z_stream
d_stream
;
/* decompression stream */
strcpy
(
reinterpret_cast
<
char
*>
(
uncompr
)
,
GARBAGE
);
strcpy
_s
(
reinterpret_cast
<
char
*>
(
uncompr
),
GARBAGE_LEN
,
GARBAGE
);
d_stream
.
zalloc
=
nullptr
;
d_stream
.
zfree
=
nullptr
;
d_stream
.
opaque
=
nullptr
;
...
...
@@ -515,7 +517,7 @@ HWTEST_F(ActsZlibTest, ActsZlibTestDictInflate, Function | MediumTest | Level2)
int
err
=
Z_OK
;
z_stream
d_stream
;
/* decompression stream */
strcpy
(
reinterpret_cast
<
char
*>
(
uncompr
)
,
GARBAGE
);
strcpy
_s
(
reinterpret_cast
<
char
*>
(
uncompr
),
GARBAGE_LEN
,
GARBAGE
);
d_stream
.
zalloc
=
nullptr
;
d_stream
.
zfree
=
nullptr
;
d_stream
.
opaque
=
nullptr
;
...
...
@@ -577,7 +579,7 @@ HWTEST_F(ActsZlibTest, ActsZlibTestCompress2, Function | MediumTest | Level2)
fprintf
(
stderr
,
"compress2 Z_BEST_COMPRESSION result: %d
\n
"
,
err
);
ASSERT_EQ
(
err
,
Z_OK
);
strcpy
(
reinterpret_cast
<
char
*>
(
uncompr
)
,
GARBAGE
);
strcpy
_s
(
reinterpret_cast
<
char
*>
(
uncompr
),
GARBAGE_LEN
,
GARBAGE
);
err
=
uncompress2
(
uncompr
,
&
uncomprLen
,
compr
,
&
comprLen
);
fprintf
(
stderr
,
"uncompress2 Z_BEST_COMPRESSION result: %d
\n
"
,
err
);
ASSERT_EQ
(
err
,
Z_OK
);
...
...
@@ -806,7 +808,7 @@ HWTEST_F(ActsZlibTest, ActsZlibTestGzBuffer, Function | MediumTest | Level2)
uncompr
=
static_cast
<
Byte
*>
(
calloc
(
static_cast
<
uInt
>
(
uncomprLen
),
CALLOC_SIZE
));
ASSERT_TRUE
(
compr
!=
Z_NULL
&&
uncompr
!=
Z_NULL
);
strcpy
(
reinterpret_cast
<
char
*>
(
uncompr
)
,
GARBAGE
);
strcpy
_s
(
reinterpret_cast
<
char
*>
(
uncompr
),
GARBAGE_LEN
,
GARBAGE
);
ASSERT_TRUE
(
gzread
(
file
,
uncompr
,
static_cast
<
unsigned
>
(
uncomprLen
))
==
len
);
ASSERT_FALSE
(
strcmp
(
reinterpret_cast
<
char
*>
(
uncompr
),
HELLO
));
...
...
@@ -950,7 +952,7 @@ HWTEST_F(ActsZlibTest, ActsZlibTestGzGets, Function | MediumTest | Level2)
Byte
*
uncompr
;
uLong
uncomprLen
=
10000
*
sizeof
(
int
);
uncompr
=
static_cast
<
Byte
*>
(
calloc
(
static_cast
<
uInt
>
(
uncomprLen
),
CALLOC_SIZE
));
strcpy
(
reinterpret_cast
<
char
*>
(
uncompr
)
,
GARBAGE
);
strcpy
_s
(
reinterpret_cast
<
char
*>
(
uncompr
),
GARBAGE_LEN
,
GARBAGE
);
fprintf
(
stderr
,
"gzgets
\n
"
);
gzgets
(
file
,
reinterpret_cast
<
char
*>
(
uncompr
),
static_cast
<
int
>
(
uncomprLen
));
ASSERT_TRUE
(
strcmp
(
reinterpret_cast
<
char
*>
(
uncompr
),
HELLO
+
SIX
));
...
...
@@ -1118,7 +1120,7 @@ HWTEST_F(ActsZlibTest, ActsZlibTestGzRead, Function | MediumTest | Level2)
uncompr
=
static_cast
<
Byte
*>
(
calloc
(
static_cast
<
uInt
>
(
uncomprLen
),
CALLOC_SIZE
));
ASSERT_TRUE
(
uncompr
!=
Z_NULL
);
strcpy
(
reinterpret_cast
<
char
*>
(
uncompr
)
,
GARBAGE
);
strcpy
_s
(
reinterpret_cast
<
char
*>
(
uncompr
),
GARBAGE_LEN
,
GARBAGE
);
ASSERT_TRUE
(
gzread
(
file
,
uncompr
,
static_cast
<
unsigned
>
(
uncomprLen
))
==
len
);
gzclose
(
file
);
#endif
...
...
@@ -1333,7 +1335,7 @@ HWTEST_F(ActsZlibTest, ActsZlibTestInflateCodesUsed, Function | MediumTest | Lev
ASSERT_TRUE
(
compr
!=
Z_NULL
&&
uncompr
!=
Z_NULL
);
unsigned
long
err
;
z_stream
d_stream
;
/* decompression stream */
strcpy
(
reinterpret_cast
<
char
*>
(
uncompr
)
,
GARBAGE
);
strcpy
_s
(
reinterpret_cast
<
char
*>
(
uncompr
),
GARBAGE_LEN
,
GARBAGE
);
d_stream
.
zalloc
=
nullptr
;
d_stream
.
zfree
=
nullptr
;
d_stream
.
opaque
=
nullptr
;
...
...
@@ -1378,7 +1380,7 @@ HWTEST_F(ActsZlibTest, ActsZlibTestInflateGetDictionary, Function | MediumTest |
int
err
=
Z_OK
;
z_stream
d_stream
;
/* decompression stream */
strcpy
(
reinterpret_cast
<
char
*>
(
uncompr
)
,
GARBAGE
);
strcpy
_s
(
reinterpret_cast
<
char
*>
(
uncompr
),
GARBAGE_LEN
,
GARBAGE
);
d_stream
.
zalloc
=
nullptr
;
d_stream
.
zfree
=
nullptr
;
d_stream
.
opaque
=
nullptr
;
...
...
@@ -1548,7 +1550,7 @@ HWTEST_F(ActsZlibTest, ActsZlibTestInflateReset, Function | MediumTest | Level2)
int
err
=
Z_OK
;
int
windowBits
=
8
;
z_stream
d_stream
;
/* decompression stream */
strcpy
(
reinterpret_cast
<
char
*>
(
uncompr
)
,
GARBAGE
);
strcpy
_s
(
reinterpret_cast
<
char
*>
(
uncompr
),
GARBAGE_LEN
,
GARBAGE
);
d_stream
.
zalloc
=
nullptr
;
d_stream
.
zfree
=
nullptr
;
d_stream
.
opaque
=
nullptr
;
...
...
@@ -1586,7 +1588,7 @@ HWTEST_F(ActsZlibTest, ActsZlibTestInflateSetDictionary, Function | MediumTest |
int
err
=
Z_OK
;
z_stream
d_stream
;
/* decompression stream */
strcpy
(
reinterpret_cast
<
char
*>
(
uncompr
)
,
GARBAGE
);
strcpy
_s
(
reinterpret_cast
<
char
*>
(
uncompr
),
GARBAGE_LEN
,
GARBAGE
);
d_stream
.
zalloc
=
nullptr
;
d_stream
.
zfree
=
nullptr
;
d_stream
.
opaque
=
nullptr
;
...
...
@@ -1620,7 +1622,7 @@ HWTEST_F(ActsZlibTest, ActsZlibTestInflateSyncPoint, Function | MediumTest | Lev
int
err
=
Z_OK
;
z_stream
d_stream
;
/* decompression stream */
strcpy
(
reinterpret_cast
<
char
*>
(
uncompr
)
,
GARBAGE
);
strcpy
_s
(
reinterpret_cast
<
char
*>
(
uncompr
),
GARBAGE_LEN
,
GARBAGE
);
d_stream
.
zalloc
=
nullptr
;
d_stream
.
zfree
=
nullptr
;
d_stream
.
opaque
=
nullptr
;
...
...
@@ -1652,7 +1654,7 @@ HWTEST_F(ActsZlibTest, ActsZlibTestInflateUndermine, Function | MediumTest | Lev
int
err
=
Z_OK
;
z_stream
d_stream
;
/* decompression stream */
strcpy
(
reinterpret_cast
<
char
*>
(
uncompr
)
,
GARBAGE
);
strcpy
_s
(
reinterpret_cast
<
char
*>
(
uncompr
),
GARBAGE_LEN
,
GARBAGE
);
d_stream
.
zalloc
=
nullptr
;
d_stream
.
zfree
=
nullptr
;
d_stream
.
opaque
=
nullptr
;
...
...
@@ -1684,7 +1686,7 @@ HWTEST_F(ActsZlibTest, ActsZlibTestInflateValidate, Function | MediumTest | Leve
int
err
=
Z_OK
;
z_stream
d_stream
;
/* decompression stream */
strcpy
(
reinterpret_cast
<
char
*>
(
uncompr
)
,
GARBAGE
);
strcpy
_s
(
reinterpret_cast
<
char
*>
(
uncompr
),
GARBAGE_LEN
,
GARBAGE
);
d_stream
.
zalloc
=
nullptr
;
d_stream
.
zfree
=
nullptr
;
d_stream
.
opaque
=
nullptr
;
...
...
appexecfwk/zlib/actszlibtest/BUILD.gn
浏览文件 @
b97b310d
...
...
@@ -20,4 +20,5 @@ ohos_moduletest_suite("ActsZlibTest") {
configs = [ "//third_party/zlib:zlib_config" ]
public_configs = [ "//third_party/zlib:zlib_public_config" ]
deps = [ "//third_party/zlib:libz" ]
external_deps = [ "utils_base:utils" ]
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录