Bug 1574512 - Fix error handling in nr_ice_set_target_for_default_local_address_lookup() r=bwc
authorRyan Alderete <ralderete@mozilla.com>
Tue, 20 Aug 2019 15:46:59 +0000
changeset 489032 0dc91d87721bbd95ec2bccd1bfff87f22125ae6d
parent 489031 71528ea79a0ac14c2b7fdbe2f5635a6c9e8a5332
child 489033 db783140934c1a27cd3132cf9baaab17c0607f82
child 489035 4f82f0b92629af3ebb20dadd661c2149f3c48f8b
push id113935
push usermalexandru@mozilla.com
push dateTue, 20 Aug 2019 22:03:24 +0000
treeherdermozilla-inbound@db783140934c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwc
bugs1574512
milestone70.0a1
first release with
nightly linux32
0dc91d87721b / 70.0a1 / 20190820215247 / files
nightly linux64
0dc91d87721b / 70.0a1 / 20190820215247 / files
nightly mac
0dc91d87721b / 70.0a1 / 20190820215247 / files
nightly win32
0dc91d87721b / 70.0a1 / 20190820215247 / files
nightly win64
0dc91d87721b / 70.0a1 / 20190820215247 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1574512 - Fix error handling in nr_ice_set_target_for_default_local_address_lookup() r=bwc If the remote IP address and port number are unable to be converted to a transport address, the context was incorrectly left with a pointer to zeroed out memory, which causes nr_ice_get_default_local_address() to abort. Freeing the address and setting the pointer to null on failure should allow the fallback to be used to retrieve the default local address. Differential Revision: https://phabricator.services.mozilla.com/D42661
media/mtransport/third_party/nICEr/src/ice/ice_ctx.c
--- a/media/mtransport/third_party/nICEr/src/ice/ice_ctx.c
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_ctx.c
@@ -796,18 +796,21 @@ int nr_ice_set_target_for_default_local_
     if (ctx->target_for_default_local_address_lookup) {
       RFREE(ctx->target_for_default_local_address_lookup);
       ctx->target_for_default_local_address_lookup=0;
     }
 
     if (!(ctx->target_for_default_local_address_lookup=RCALLOC(sizeof(nr_transport_addr))))
       ABORT(R_NO_MEMORY);
 
-    if ((r=nr_str_port_to_transport_addr(target_ip, target_port, IPPROTO_UDP, ctx->target_for_default_local_address_lookup)))
+    if ((r=nr_str_port_to_transport_addr(target_ip, target_port, IPPROTO_UDP, ctx->target_for_default_local_address_lookup))) {
+      RFREE(ctx->target_for_default_local_address_lookup);
+      ctx->target_for_default_local_address_lookup=0;
       ABORT(r);
+    }
 
     _status=0;
   abort:
     return(_status);
   }
 
 int nr_ice_gather(nr_ice_ctx *ctx, NR_async_cb done_cb, void *cb_arg)
   {