Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of possibly uninitialized variable body_chunk_len in lib/roles/h2/http2.c #3004

Closed
schuettecarsten opened this issue Nov 10, 2023 · 1 comment

Comments

@schuettecarsten
Copy link

schuettecarsten commented Nov 10, 2023

Use of uninitialized variable in lib/roles/h2/http2.c.
lws_filepos_t body_chunk_len is declared in line 2819 and used later, but might not be initialized.

Is it safe to simply initialize this with 0?

@lws-team
Copy link
Member

Thanks... we only try to use body_chunk_len if lws_h2_parser() returns 0 or 2. Going through lws_h2_parser(), every way out of it returning 0 or 2, sets body_chunk_len (it's passed in pointed-to by inused arg to lws_h2_parser()). So I believe this is a false positive.

FWIW F39 gcc 13.2 did not blow any errors AFAIK.

Of course, in terms of an error coming out of the compiler and killing the build, it doesn't make much odds, it still emits an error rightly or wrongly the same. But since it's wrong, we only need to help the compiler see it's wrong so just zeroing should be fine.

I pushed a patch doing that (and moving the declaration scope inside the loop) on main + v4.3-stable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants