Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
ae9d676c
Commit
ae9d676c
authored
Mar 22, 2018
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix base64 encoding when char is unsigned.
Tested on qemu-aarch64.
parent
6fd94839
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
encoding.c++
c++/src/kj/encoding.c++
+5
-5
No files found.
c++/src/kj/encoding.c++
View file @
ae9d676c
...
...
@@ -822,7 +822,7 @@ int base64_decode_block(const char* code_in, const int length_in,
char
*
plaintext_out
,
base64_decodestate
*
state_in
)
{
const
char
*
codechar
=
code_in
;
char
*
plainchar
=
plaintext_out
;
char
fragment
;
signed
char
fragment
;
if
(
state_in
->
step
!=
step_a
)
{
*
plainchar
=
state_in
->
plainchar
;
...
...
@@ -841,7 +841,7 @@ int base64_decode_block(const char* code_in, const int length_in,
state_in
->
plainchar
=
'\0'
;
return
plainchar
-
plaintext_out
;
}
fragment
=
(
char
)
base64_decode_value
(
*
codechar
++
);
fragment
=
(
signed
char
)
base64_decode_value
(
*
codechar
++
);
// It is an error to see invalid or padding bytes in step A.
ERROR_IF
(
fragment
<
-
1
);
}
while
(
fragment
<
0
);
...
...
@@ -857,7 +857,7 @@ int base64_decode_block(const char* code_in, const int length_in,
state_in
->
hadErrors
=
true
;
return
plainchar
-
plaintext_out
;
}
fragment
=
(
char
)
base64_decode_value
(
*
codechar
++
);
fragment
=
(
signed
char
)
base64_decode_value
(
*
codechar
++
);
// It is an error to see invalid or padding bytes in step B.
ERROR_IF
(
fragment
<
-
1
);
}
while
(
fragment
<
0
);
...
...
@@ -874,7 +874,7 @@ int base64_decode_block(const char* code_in, const int length_in,
ERROR_IF
(
state_in
->
nPaddingBytesSeen
==
1
);
return
plainchar
-
plaintext_out
;
}
fragment
=
(
char
)
base64_decode_value
(
*
codechar
++
);
fragment
=
(
signed
char
)
base64_decode_value
(
*
codechar
++
);
// It is an error to see invalid bytes or more than two padding bytes in step C.
ERROR_IF
(
fragment
<
-
2
||
(
fragment
==
-
2
&&
++
state_in
->
nPaddingBytesSeen
>
2
));
}
while
(
fragment
<
0
);
...
...
@@ -889,7 +889,7 @@ int base64_decode_block(const char* code_in, const int length_in,
state_in
->
plainchar
=
*
plainchar
;
return
plainchar
-
plaintext_out
;
}
fragment
=
(
char
)
base64_decode_value
(
*
codechar
++
);
fragment
=
(
signed
char
)
base64_decode_value
(
*
codechar
++
);
// It is an error to see invalid bytes or more than one padding byte in step D.
ERROR_IF
(
fragment
<
-
2
||
(
fragment
==
-
2
&&
++
state_in
->
nPaddingBytesSeen
>
1
));
}
while
(
fragment
<
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