clang analyzer had issues detecting that the status line is constructed
whenever the `H2_PHDR_FND_NONE` flag is set. Help it by BUG_ON(!sl).
Another possibility might be just replacing the check for `H2_PHDR_FND_NONE`
by a check for the existance of the status line: `!sl`. I'll leave the
evaluation of that up to the maintainers.
---
src/h2.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/h2.c b/src/h2.c
index 990d602b1..2faf84bb9 100644
--- a/src/h2.c
+++ b/src/h2.c
@@ -694,6 +694,10 @@ int h2_make_htx_request(struct http_hdr *list, struct htx
*htx, unsigned int *ms
if (!sl)
goto fail;
}
+ else {
+ /* Whenever the flag for a non-pseudo header is set the status
line is constructed. */
+ BUG_ON(!sl);
+ }
if (!(*msgf & H2_MSGF_BODY) || ((*msgf & H2_MSGF_BODY_CL) && *body_len
== 0))
sl_flags |= HTX_SL_F_BODYLESS;
@@ -918,6 +922,10 @@ int h2_make_htx_response(struct http_hdr *list, struct htx
*htx, unsigned int *m
if (!sl)
goto fail;
}
+ else {
+ /* Whenever the flag for a non-pseudo header is set the status
line is constructed. */
+ BUG_ON(!sl);
+ }
if (!(*msgf & H2_MSGF_BODY) || ((*msgf & H2_MSGF_BODY_CL) && *body_len
== 0))
sl_flags |= HTX_SL_F_BODYLESS;
--
2.21.0