Blame SOURCES/nghttp2-1.7.1-CVE-2019-9511-and-CVE-2019-9513.patch

e996a2
diff --git a/src/HttpServer.cc b/src/HttpServer.cc
e996a2
index ee07845..4545922 100644
e996a2
--- a/src/HttpServer.cc
e996a2
+++ b/src/HttpServer.cc
e996a2
@@ -614,6 +614,7 @@ int Http2Handler::read_clear() {
e996a2
       }
e996a2
       return -1;
e996a2
     }
e996a2
+    break;
e996a2
   }
e996a2
 
e996a2
   return write_(*this);
e996a2
@@ -739,6 +740,7 @@ int Http2Handler::read_tls() {
e996a2
       }
e996a2
       return -1;
e996a2
     }
e996a2
+    break;
e996a2
   }
e996a2
 
e996a2
 fin:
e996a2
diff --git a/src/shrpx_client_handler.cc b/src/shrpx_client_handler.cc
e996a2
index ed161db..b8dbd3c 100644
e996a2
--- a/src/shrpx_client_handler.cc
e996a2
+++ b/src/shrpx_client_handler.cc
e996a2
@@ -114,6 +114,7 @@ void writecb(struct ev_loop *loop, ev_io *w, int revents) {
e996a2
 int ClientHandler::noop() { return 0; }
e996a2
 
e996a2
 int ClientHandler::read_clear() {
e996a2
+  auto should_break = false;
e996a2
   ev_timer_again(conn_.loop, &conn_.rt);
e996a2
 
e996a2
   for (;;) {
e996a2
@@ -126,6 +127,10 @@ int ClientHandler::read_clear() {
e996a2
       conn_.rlimit.stopw();
e996a2
       return 0;
e996a2
     }
e996a2
+    
e996a2
+    if (should_break) {
e996a2
+      return 0;
e996a2
+    }
e996a2
 
e996a2
     auto nread = conn_.read_clear(rb_.last, rb_.wleft());
e996a2
 
e996a2
@@ -138,6 +143,7 @@ int ClientHandler::read_clear() {
e996a2
     }
e996a2
 
e996a2
     rb_.write(nread);
e996a2
+    should_break = true;
e996a2
   }
e996a2
 }
e996a2
 
e996a2
@@ -204,6 +210,7 @@ int ClientHandler::tls_handshake() {
e996a2
 }
e996a2
 
e996a2
 int ClientHandler::read_tls() {
e996a2
+  auto should_break = false;
e996a2
   ev_timer_again(conn_.loop, &conn_.rt);
e996a2
 
e996a2
   ERR_clear_error();
e996a2
@@ -219,6 +226,10 @@ int ClientHandler::read_tls() {
e996a2
       conn_.rlimit.stopw();
e996a2
       return 0;
e996a2
     }
e996a2
+    
e996a2
+    if (should_break) {
e996a2
+      return 0;
e996a2
+    }
e996a2
 
e996a2
     auto nread = conn_.read_tls(rb_.last, rb_.wleft());
e996a2
 
e996a2
@@ -231,6 +242,7 @@ int ClientHandler::read_tls() {
e996a2
     }
e996a2
 
e996a2
     rb_.write(nread);
e996a2
+    should_break = true;
e996a2
   }
e996a2
 }
e996a2