Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
8650d5fa
Commit
8650d5fa
authored
Jan 20, 2012
by
Reimar Döffinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
base64: more thorough decode tests.
Signed-off-by:
Reimar Döffinger
<
Reimar.Doeffinger@gmx.de
>
parent
77b90f0c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
1 deletion
+20
-1
base64.c
libavutil/base64.c
+20
-1
No files found.
libavutil/base64.c
View file @
8650d5fa
...
...
@@ -136,15 +136,34 @@ static int test_encode_decode(const uint8_t *data, unsigned int data_size,
return
1
;
}
if
((
data2_size
=
av_base64_decode
(
data2
,
encoded
,
max_data2_size
))
<
0
)
{
if
((
data2_size
=
av_base64_decode
(
data2
,
encoded
,
max_data2_size
))
!=
data_size
)
{
printf
(
"Failed: cannot decode the encoded string
\n
"
"Encoded:
\n
%s
\n
"
,
encoded
);
return
1
;
}
if
((
data2_size
=
av_base64_decode
(
data2
,
encoded
,
data_size
))
!=
data_size
)
{
printf
(
"Failed: cannot decode with minimal buffer
\n
"
"Encoded:
\n
%s
\n
"
,
encoded
);
return
1
;
}
if
(
memcmp
(
data2
,
data
,
data_size
))
{
printf
(
"Failed: encoded/decoded data differs from original data
\n
"
);
return
1
;
}
if
(
av_base64_decode
(
NULL
,
encoded
,
0
)
!=
0
)
{
printf
(
"Failed: decode to NULL buffer
\n
"
);
return
1
;
}
if
(
strlen
(
encoded
))
{
char
*
end
=
strchr
(
encoded
,
'='
);
if
(
!
end
)
end
=
encoded
+
strlen
(
encoded
)
-
1
;
*
end
=
'%'
;
if
(
av_base64_decode
(
NULL
,
encoded
,
0
)
>=
0
)
{
printf
(
"Failed: error detection
\n
"
);
return
1
;
}
}
printf
(
"Passed!
\n
"
);
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment