Fix a crash when a HTTP input connected to an UDP output goes unavailable. master
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 16 May 2021 13:04:34 +0000 (15:04 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 16 May 2021 13:04:40 +0000 (15:04 +0200)
serverpool.cpp

index c7ff10cf2866057e3ddc7a996a6d999da967720e..7b790c29b4e87de793a58de34d9a077861da54cb 100644 (file)
@@ -181,10 +181,11 @@ void ServerPool::add_data(int stream_index, const char *data, size_t bytes, uint
 
 void ServerPool::set_unavailable(int stream_index)
 {
 
 void ServerPool::set_unavailable(int stream_index)
 {
-       assert(stream_index >= 0 && stream_index < ssize_t(num_http_streams));
-
-       for (int i = 0; i < num_servers; ++i) {
-               servers[i].set_unavailable(stream_index);
+       assert(stream_index >= 0 && stream_index < ssize_t(num_http_streams + udp_streams.size()));
+       if (stream_index < ssize_t(num_http_streams)) {
+               for (int i = 0; i < num_servers; ++i) {
+                       servers[i].set_unavailable(stream_index);
+               }
        }
 }
 
        }
 }