Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
5ae9bb89
Commit
5ae9bb89
authored
Nov 09, 2019
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fail fast if huffman decoding context is in failure state
parent
bb519154
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
0 deletions
+23
-0
lib/nghttp2_hd.c
lib/nghttp2_hd.c
+5
-0
lib/nghttp2_hd.h
lib/nghttp2_hd.h
+6
-0
lib/nghttp2_hd_huffman.c
lib/nghttp2_hd_huffman.c
+4
-0
tests/nghttp2_hd_test.c
tests/nghttp2_hd_test.c
+8
-0
No files found.
lib/nghttp2_hd.c
View file @
5ae9bb89
...
...
@@ -1694,6 +1694,11 @@ static ssize_t hd_inflate_read_huff(nghttp2_hd_inflater *inflater,
DEBUGF
(
"inflatehd: huffman decoding failed
\n
"
);
return
readlen
;
}
if
(
nghttp2_hd_huff_decode_failure_state
(
&
inflater
->
huff_decode_ctx
))
{
DEBUGF
(
"inflatehd: huffman decoding failed
\n
"
);
return
NGHTTP2_ERR_HEADER_COMP
;
}
inflater
->
left
-=
(
size_t
)
readlen
;
return
readlen
;
}
...
...
lib/nghttp2_hd.h
View file @
5ae9bb89
...
...
@@ -430,4 +430,10 @@ ssize_t nghttp2_hd_huff_decode(nghttp2_hd_huff_decode_context *ctx,
nghttp2_buf
*
buf
,
const
uint8_t
*
src
,
size_t
srclen
,
int
fin
);
/*
* nghttp2_hd_huff_decode_failure_state returns nonzero if |ctx|
* indicates that huffman decoding context is in failure state.
*/
int
nghttp2_hd_huff_decode_failure_state
(
nghttp2_hd_huff_decode_context
*
ctx
);
#endif
/* NGHTTP2_HD_H */
lib/nghttp2_hd_huffman.c
View file @
5ae9bb89
...
...
@@ -138,3 +138,7 @@ ssize_t nghttp2_hd_huff_decode(nghttp2_hd_huff_decode_context *ctx,
return
(
ssize_t
)
srclen
;
}
int
nghttp2_hd_huff_decode_failure_state
(
nghttp2_hd_huff_decode_context
*
ctx
)
{
return
ctx
->
fstate
==
0x100
;
}
tests/nghttp2_hd_test.c
View file @
5ae9bb89
...
...
@@ -1566,4 +1566,12 @@ void test_nghttp2_hd_huff_decode(void) {
len
=
nghttp2_hd_huff_decode
(
&
ctx
,
&
outbuf
,
e
,
2
,
6
);
CU_ASSERT
(
NGHTTP2_ERR_HEADER_COMP
==
len
);
/* Check failure state */
nghttp2_buf_wrap_init
(
&
outbuf
,
b
,
sizeof
(
b
));
nghttp2_hd_huff_decode_context_init
(
&
ctx
);
len
=
nghttp2_hd_huff_decode
(
&
ctx
,
&
outbuf
,
e
,
5
,
0
);
CU_ASSERT
(
5
==
len
);
CU_ASSERT
(
nghttp2_hd_huff_decode_failure_state
(
&
ctx
));
}
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