[vlc-commits] [Git][videolan/vlc][master] 2 commits: tests: rtpfmt: check empty attribute parsing

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Jul 29 01:57:49 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
2c5c7d51 by Tristan Matthews at 2026-07-29T01:34:17+00:00
tests: rtpfmt: check empty attribute parsing

This is a regression test for the fix done in 599b7337a1aede4ffab33be9042f834c42173e4b

- - - - -
b0850621 by Tristan Matthews at 2026-07-29T01:34:17+00:00
tests: rtpfmt: check parsing of slash-prefix addresses

This is a regression test for the fix done in d38aa472bce9965bed2fea89222d4dc2e48cea0e

- - - - -


2 changed files:

- modules/access/rtp/test/rtpfmt.c
- modules/access/rtp/test/sdp.c


Changes:

=====================================
modules/access/rtp/test/rtpfmt.c
=====================================
@@ -93,7 +93,12 @@ int main(void)
         "m=naughty 5010 RTP/AVP 64 64 foobar 128 255\r\n"
         "a=rtpmap:64 invalid/0/0\r\n"
         "m=evil 5010 RTP/AVP 42 128 255\r\n"
-        "a=rtpmap:128 overflow/90000\r\n";
+        "a=rtpmap:128 overflow/90000\r\n"
+        "m=undead 5012 RTP/AVP 96\r\n"
+        "a=rtpmap\r\n"
+        "a=fmtp\r\n"
+        "a=recvonly\r\n"
+        "a=rtpmap:96 t140/1000\r\n";
 
     int val;
 
@@ -130,6 +135,13 @@ int main(void)
     EXPECT_PTS();
     vlc_rtp_add_media_types(NULL, NULL, media, &owner);
 
+    /* undead: attributes without a value must be skipped, not dereferenced */
+    media = media->next;
+    assert(media != NULL);
+    EXPECT_PTS(96);
+    val = vlc_rtp_add_media_types(NULL, NULL, media, &owner);
+    assert(val == 0);
+
     media = media->next;
     EXPECT_PTS();
     assert(media == NULL);


=====================================
modules/access/rtp/test/sdp.c
=====================================
@@ -121,6 +121,35 @@ int main(void)
 
     vlc_sdp_free(sdp);
 
+    /* Connection address starting with '/': the first sscanf() conversion
+     * fails, so the truncation offset must default to zero. */
+    static const char slashaddr[] =
+        "v=0\r\n"
+        "o=- 0 0 x y z\r\n"
+        "s=\r\n"
+        "c=IN IP4 /127\r\n"
+        "t=0 0\r\n"
+        "m=text 5004 RTP/AVP 96\r\n"
+        "c=IN IP6 /2\r\n";
+
+    test_sdp_valid(slashaddr);
+
+    sdp = vlc_sdp_parse(slashaddr, strlen(slashaddr));
+    assert(sdp != NULL);
+    c = sdp->conn;
+    assert(c != NULL);
+    assert(c->family == 4);
+    assert(!strcmp(c->addr, ""));
+    assert(c->ttl == 255);
+    assert(c->addr_count == 1);
+    assert(sdp->media != NULL);
+    c = vlc_sdp_media_conn(sdp->media);
+    assert(c != NULL);
+    assert(c->family == 6);
+    assert(!strcmp(c->addr, ""));
+    assert(c->addr_count == 1);
+    vlc_sdp_free(sdp);
+
     char smallest[] =
         "v=0\n"
         "o=- 0 0 x y z\n"



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0b7ccd1fa180bacbddee7fa41c0710c16fc5a965...b085062149a2e04fef48c12ac40d13254f7f7a95

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0b7ccd1fa180bacbddee7fa41c0710c16fc5a965...b085062149a2e04fef48c12ac40d13254f7f7a95
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list