rtpsource: rewrite timeout-check to avoid underflow
authorHavard Graff <havard.graff@gmail.com>
Fri, 13 Nov 2020 11:39:53 +0000 (12:39 +0100)
committerHavard Graff <havard.graff@gmail.com>
Fri, 13 Nov 2020 20:30:06 +0000 (21:30 +0100)
If current_time is < collision_timeout, we get an uint64 underflow, and
the check will trigger prematurely.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/817>

gst/rtpmanager/rtpsource.c

index 628005e5bb2e923aebf2b677266ad87d8c02befe..865848c495fb16c33b3ba96982c2b25ef7f746c4 100644 (file)
@@ -1831,7 +1831,7 @@ timeout_conflicting_addresses (GList * conflicting_addresses,
     RTPConflictingAddress *known_conflict = item->data;
     GList *next_item = g_list_next (item);
 
-    if (known_conflict->time < current_time - collision_timeout) {
+    if (known_conflict->time + collision_timeout < current_time) {
       gchar *buf;
 
       conflicting_addresses = g_list_delete_link (conflicting_addresses, item);