]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Don't try to convert consumed bytes to a nghttp2 error 17153/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 17 Apr 2026 11:06:27 +0000 (13:06 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 17 Apr 2026 11:06:27 +0000 (13:06 +0200)
Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
pdns/dnsdistdist/dnsdist-nghttp2.cc

index 3edcbd5897c7fb9dd963bb2b772a00de63db71c2..d26ff2ef65bd6dca035e53c3f99c4eda2938a8d2 100644 (file)
@@ -403,9 +403,12 @@ void DoHConnectionToBackend::handleReadableIOCallback(int fd, FDMultiplexer::fun
         // cerr<<"nghttp2_session_mem_recv returned "<<readlen<<endl;
         /* as long as we don't require a pause by returning nghttp2_error.NGHTTP2_ERR_PAUSE from a CB,
            all data should be consumed before returning */
-        if (readlen < 0 || static_cast<size_t>(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<int>(readlen))));
         }
+        if (static_cast<size_t>(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};