Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
9fee3ba0
Commit
9fee3ba0
authored
9 years ago
by
Yang Gao
Browse files
Options
Downloads
Plain Diff
Merge pull request #4335 from ctiller/partial-send-header
Expand HPACK decoding test cases
parents
3e37ee84
a83cc5e9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/core/transport/chttp2/hpack_parser.c
+3
-2
3 additions, 2 deletions
src/core/transport/chttp2/hpack_parser.c
test/core/bad_client/tests/headers.c
+57
-0
57 additions, 0 deletions
test/core/bad_client/tests/headers.c
with
60 additions
and
2 deletions
src/core/transport/chttp2/hpack_parser.c
+
3
−
2
View file @
9fee3ba0
...
@@ -1066,7 +1066,7 @@ static int parse_value4(grpc_chttp2_hpack_parser *p, const gpr_uint8 *cur,
...
@@ -1066,7 +1066,7 @@ static int parse_value4(grpc_chttp2_hpack_parser *p, const gpr_uint8 *cur,
error:
error:
gpr_log
(
GPR_ERROR
,
gpr_log
(
GPR_ERROR
,
"integer overflow in hpack integer decoding: have 0x%08x, "
"integer overflow in hpack integer decoding: have 0x%08x, "
"got byte 0x%02x"
,
"got byte 0x%02x
on byte 5
"
,
*
p
->
parsing
.
value
,
*
cur
);
*
p
->
parsing
.
value
,
*
cur
);
return
parse_error
(
p
,
cur
,
end
);
return
parse_error
(
p
,
cur
,
end
);
}
}
...
@@ -1091,7 +1091,8 @@ static int parse_value5up(grpc_chttp2_hpack_parser *p, const gpr_uint8 *cur,
...
@@ -1091,7 +1091,8 @@ static int parse_value5up(grpc_chttp2_hpack_parser *p, const gpr_uint8 *cur,
gpr_log
(
GPR_ERROR
,
gpr_log
(
GPR_ERROR
,
"integer overflow in hpack integer decoding: have 0x%08x, "
"integer overflow in hpack integer decoding: have 0x%08x, "
"got byte 0x%02x sometime after byte 4"
);
"got byte 0x%02x sometime after byte 5"
,
*
p
->
parsing
.
value
,
*
cur
);
return
parse_error
(
p
,
cur
,
end
);
return
parse_error
(
p
,
cur
,
end
);
}
}
...
...
This diff is collapsed.
Click to expand it.
test/core/bad_client/tests/headers.c
+
57
−
0
View file @
9fee3ba0
...
@@ -94,6 +94,10 @@ int main(int argc, char **argv) {
...
@@ -94,6 +94,10 @@ int main(int argc, char **argv) {
"
\x00\x00\x04\x01\x24\x00\x00\x00\x01
"
"
\x00\x00\x04\x01\x24\x00\x00\x00\x01
"
"
\x00\x00\x00\x00
"
,
"
\x00\x00\x00\x00
"
,
0
);
0
);
GRPC_RUN_BAD_CLIENT_TEST
(
verifier
,
PFX_STR
"
\x00\x00\x05\x01\x24\x00\x00\x00\x01
"
""
,
GRPC_BAD_CLIENT_DISCONNECT
);
GRPC_RUN_BAD_CLIENT_TEST
(
verifier
,
PFX_STR
GRPC_RUN_BAD_CLIENT_TEST
(
verifier
,
PFX_STR
"
\x00\x00\x05\x01\x24\x00\x00\x00\x01
"
"
\x00\x00\x05\x01\x24\x00\x00\x00\x01
"
"
\x00
"
,
"
\x00
"
,
...
@@ -171,10 +175,52 @@ int main(int argc, char **argv) {
...
@@ -171,10 +175,52 @@ int main(int argc, char **argv) {
"
\x00\x00\x07\x01\x04\x00\x00\x00\x01
"
"
\x00\x00\x07\x01\x04\x00\x00\x00\x01
"
"
\xff\x80\x80\x80\x80\x80\x00
"
,
"
\xff\x80\x80\x80\x80\x80\x00
"
,
0
);
0
);
GRPC_RUN_BAD_CLIENT_TEST
(
verifier
,
PFX_STR
"
\x00\x00\x08\x01\x04\x00\x00\x00\x01
"
"
\xff
"
,
GRPC_BAD_CLIENT_DISCONNECT
);
GRPC_RUN_BAD_CLIENT_TEST
(
verifier
,
PFX_STR
"
\x00\x00\x08\x01\x04\x00\x00\x00\x01
"
"
\xff\x80
"
,
GRPC_BAD_CLIENT_DISCONNECT
);
GRPC_RUN_BAD_CLIENT_TEST
(
verifier
,
PFX_STR
"
\x00\x00\x08\x01\x04\x00\x00\x00\x01
"
"
\xff\x80\x80
"
,
GRPC_BAD_CLIENT_DISCONNECT
);
GRPC_RUN_BAD_CLIENT_TEST
(
verifier
,
PFX_STR
"
\x00\x00\x08\x01\x04\x00\x00\x00\x01
"
"
\xff\x80\x80\x80
"
,
GRPC_BAD_CLIENT_DISCONNECT
);
GRPC_RUN_BAD_CLIENT_TEST
(
verifier
,
PFX_STR
"
\x00\x00\x08\x01\x04\x00\x00\x00\x01
"
"
\xff\x80\x80\x80\x80
"
,
GRPC_BAD_CLIENT_DISCONNECT
);
GRPC_RUN_BAD_CLIENT_TEST
(
verifier
,
PFX_STR
"
\x00\x00\x08\x01\x04\x00\x00\x00\x01
"
"
\xff\x80\x80\x80\x80\x80
"
,
GRPC_BAD_CLIENT_DISCONNECT
);
GRPC_RUN_BAD_CLIENT_TEST
(
verifier
,
PFX_STR
"
\x00\x00\x08\x01\x04\x00\x00\x00\x01
"
"
\xff\x80\x80\x80\x80\x80\x80
"
,
GRPC_BAD_CLIENT_DISCONNECT
);
GRPC_RUN_BAD_CLIENT_TEST
(
verifier
,
PFX_STR
GRPC_RUN_BAD_CLIENT_TEST
(
verifier
,
PFX_STR
"
\x00\x00\x08\x01\x04\x00\x00\x00\x01
"
"
\x00\x00\x08\x01\x04\x00\x00\x00\x01
"
"
\xff\x80\x80\x80\x80\x80\x80\x00
"
,
"
\xff\x80\x80\x80\x80\x80\x80\x00
"
,
0
);
0
);
/* overflow on byte 4 */
GRPC_RUN_BAD_CLIENT_TEST
(
verifier
,
PFX_STR
"
\x00\x00\x06\x01\x04\x00\x00\x00\x01
"
"
\xff\x80\x80\x80\x80\x7f
"
,
GRPC_BAD_CLIENT_DISCONNECT
);
GRPC_RUN_BAD_CLIENT_TEST
(
verifier
,
PFX_STR
"
\x00\x00\x06\x01\x04\x00\x00\x00\x01
"
"
\xff\xff\xff\xff\xff\x0f
"
,
GRPC_BAD_CLIENT_DISCONNECT
);
/* overflow after byte 4 */
GRPC_RUN_BAD_CLIENT_TEST
(
verifier
,
PFX_STR
"
\x00\x00\x08\x01\x04\x00\x00\x00\x01
"
"
\xff\x80\x80\x80\x80\x80\x80\x02
"
,
0
);
/* end of headers mid-opcode */
/* end of headers mid-opcode */
GRPC_RUN_BAD_CLIENT_TEST
(
verifier
,
PFX_STR
GRPC_RUN_BAD_CLIENT_TEST
(
verifier
,
PFX_STR
"
\x00\x00\x01\x01\x04\x00\x00\x00\x01
"
"
\x00\x00\x01\x01\x04\x00\x00\x00\x01
"
...
@@ -187,11 +233,22 @@ int main(int argc, char **argv) {
...
@@ -187,11 +233,22 @@ int main(int argc, char **argv) {
"
\x00\x00\x03\x01\x04\x00\x00\x00\x01
"
"
\x00\x00\x03\x01\x04\x00\x00\x00\x01
"
"
\x3f\xe1\x1f
"
,
"
\x3f\xe1\x1f
"
,
GRPC_BAD_CLIENT_DISCONNECT
);
GRPC_BAD_CLIENT_DISCONNECT
);
/* dynamic table size update: set too large */
GRPC_RUN_BAD_CLIENT_TEST
(
verifier
,
GRPC_RUN_BAD_CLIENT_TEST
(
verifier
,
PFX_STR
PFX_STR
"
\x00\x00\x03\x01\x04\x00\x00\x00\x01
"
"
\x00\x00\x03\x01\x04\x00\x00\x00\x01
"
"
\x3f\xf1\x1f
"
,
"
\x3f\xf1\x1f
"
,
0
);
0
);
/* dynamic table size update: set twice */
GRPC_RUN_BAD_CLIENT_TEST
(
verifier
,
PFX_STR
"
\x00\x00\x04\x01\x04\x00\x00\x00\x01
"
"
\x20\x3f\xe1\x1f
"
,
GRPC_BAD_CLIENT_DISCONNECT
);
/* dynamic table size update: set thrice */
GRPC_RUN_BAD_CLIENT_TEST
(
verifier
,
PFX_STR
"
\x00\x00\x03\x01\x04\x00\x00\x00\x01
"
"
\x20\x20\x20
"
,
0
);
/* non-ending header followed by continuation frame */
/* non-ending header followed by continuation frame */
GRPC_RUN_BAD_CLIENT_TEST
(
verifier
,
GRPC_RUN_BAD_CLIENT_TEST
(
verifier
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment