From 7db0a147fd9255cd4b4349492a311e9841757113 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Fri, 17 Apr 2026 13:06:27 +0200 Subject: [PATCH] dnsdist: Don't try to convert consumed bytes to a nghttp2 error Signed-off-by: Remi Gacogne --- pdns/dnsdistdist/dnsdist-nghttp2.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pdns/dnsdistdist/dnsdist-nghttp2.cc b/pdns/dnsdistdist/dnsdist-nghttp2.cc index 3edcbd5897..d26ff2ef65 100644 --- a/pdns/dnsdistdist/dnsdist-nghttp2.cc +++ b/pdns/dnsdistdist/dnsdist-nghttp2.cc @@ -403,9 +403,12 @@ void DoHConnectionToBackend::handleReadableIOCallback(int fd, FDMultiplexer::fun // cerr<<"nghttp2_session_mem_recv returned "<(readlen) < conn->d_inPos) { + if (readlen < 0) { throw std::runtime_error("Fatal error while passing received data to nghttp2: " + std::string(nghttp2_strerror(static_cast(readlen)))); } + if (static_cast(readlen) < conn->d_inPos) { + throw std::runtime_error("Data was not entirely processed (" + std::to_string(readlen) + " bytes out of " + std::to_string(conn->d_inPos) + ") while passing received data to nghttp2"); + } struct timeval now{ .tv_sec = 0, .tv_usec = 0}; -- 2.47.3