Bug 1373843: Change assertion about message length to error in stun_codec.c; r=drno
authorDan Minor <dminor@mozilla.com>
Tue, 19 Sep 2017 15:29:22 -0400
changeset 431414 94f776f0a81665c6bdbe7bf6cea246810b2e3c12
parent 431413 34ddff9dde5093e226866c74cda9f74aaf4fade8
child 431415 0ecd18f1020354adbdbc6ba3734ae69b1621c88a
push id7784
push userryanvm@gmail.com
push dateThu, 21 Sep 2017 00:40:13 +0000
treeherdermozilla-beta@efff4f307675 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdrno
bugs1373843
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1373843: Change assertion about message length to error in stun_codec.c; r=drno MozReview-Commit-ID: 1oUEQk9vg1L
media/mtransport/third_party/nICEr/src/stun/stun_codec.c
--- a/media/mtransport/third_party/nICEr/src/stun/stun_codec.c
+++ b/media/mtransport/third_party/nICEr/src/stun/stun_codec.c
@@ -732,17 +732,20 @@ nr_stun_attr_codec_fingerprint_decode(nr
     /* the length must include the FINGERPRINT attribute when computing
      * the fingerprint */
     length = offset;  /* right before FINGERPRINT */
     length -= sizeof(*header); /* remove header length */
     length += 8;  /* add length of Fingerprint */
     header->length = htons(length);
 
     /* make sure FINGERPRINT is final attribute in message */
-    assert(length + sizeof(*header) == buflen);
+    if (length + sizeof(*header) != buflen) {
+        r_log(NR_LOG_STUN, LOG_WARNING, "Fingerprint is not final attribute in message");
+        ABORT(R_FAILED);
+    }
 
     if (r_crc32((char*)buf, offset, &checksum)) {
         r_log(NR_LOG_STUN, LOG_WARNING, "Unable to compute fingerprint");
         ABORT(R_FAILED);
     }
 
     fingerprint->valid = (fingerprint->checksum == (checksum ^ 0x5354554e));