]> 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>
Thu, 4 Sep 2025 15:11:53 +0000 (17:11 +0200)
commitcde88a29164bbbd8e6b27af3ed368746608201db
treece9b126a9bafc85bdee8305566252052e9cd128d
parente4e70231c1f2eea330b9aeece15c1db20c1b8894
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>
(cherry picked from commit 346d37abe3beedcec8c856ea4421311de4df1d24)
pdns/dnsdistdist/dnsdist-nghttp2.cc
pdns/dnsdistdist/dnsdist-tcp.cc
pdns/dnsdistdist/dnsdist-tcp.hh
pdns/dnsdistdist/test-dnsdistnghttp2_cc.cc