]> git.ipfire.org Git - thirdparty/pdns.git/commit
dnsdist: Fix a memory access violation in the nghttp2 unit tests
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 22 Aug 2025 07:57:57 +0000 (09:57 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 25 Aug 2025 13:15:59 +0000 (15:15 +0200)
commit346d37abe3beedcec8c856ea4421311de4df1d24
tree4b74c2f88bddfd04c36c279203a93a2ccb3704ab
parent9eeac00a7c7d336317ff0ae1750675aa3a8107da
dnsdist: Fix a memory access violation in the nghttp2 unit tests

Calling `nghttp2_session_send` from a callback does not work well
when ``nghttp2_session_send`` ends up closing the current stream,
triggering a use-after-free.
It's not clear from the API documentation, but it is mentioned in
the programmers' guide's remarks:

> Do not call `nghttp2_session_send()`, `nghttp2_session_mem_send2()`,
`nghttp2_session_recv()` or `nghttp2_session_mem_recv2()` from the
nghttp2 callback functions directly or indirectly. It will lead to the
crash. You can submit requests or frames in the callbacks then call
these functions outside the callbacks.

Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
pdns/dnsdistdist/dnsdist-nghttp2.cc
pdns/dnsdistdist/dnsdist-tcp.cc
pdns/dnsdistdist/dnsdist-tcp.hh
pdns/dnsdistdist/test-dnsdistnghttp2_cc.cc