Bug 798873 - Signaling - increase max SDP size (temporary until better fix). r=jesup,ekr
authorEthan Hugg <ethanhugg@gmail.com>
Sun, 07 Oct 2012 22:28:52 -0700
changeset 113273 87f3548e638eb6db3f94999c5dbff353830dcb4c
parent 113272 4c95b705edb00362830b235103edb1bd95ab57e4
child 113274 2704e441363fe2a48e992dfac694482dfd82664a
push id2248
push userakeybl@mozilla.com
push dateMon, 08 Oct 2012 19:23:44 +0000
treeherdermozilla-aurora@118a3b748323 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup, ekr
bugs798873
milestone18.0a1
Bug 798873 - Signaling - increase max SDP size (temporary until better fix). r=jesup,ekr
media/webrtc/signaling/src/sipcc/core/sdp/sdp.h
media/webrtc/signaling/src/sipcc/core/sdp/sdp_attr.c
media/webrtc/signaling/src/sipcc/core/sipstack/ccsip_sdp.c
media/webrtc/signaling/src/sipcc/core/sipstack/h/ccsip_sdp.h
--- a/media/webrtc/signaling/src/sipcc/core/sdp/sdp.h
+++ b/media/webrtc/signaling/src/sipcc/core/sdp/sdp.h
@@ -48,17 +48,17 @@
 /* The following defines are used to indicate params that are specified 
  * as the choose parameter or parameters that are invalid.  These can   
  * be used where the value required is really a u16, but is represented
  * by an int32.
  */
 #define SDP_CHOOSE_PARAM           (-1)
 #define SDP_SESSION_LEVEL        0xFFFF
 
-#define SDP_MAX_LEN                2048
+#define SDP_MAX_LEN                4096
 
 #define UNKNOWN_CRYPTO_SUITE              "UNKNOWN_CRYPTO_SUITE"
 #define AES_CM_128_HMAC_SHA1_32           "AES_CM_128_HMAC_SHA1_32"
 #define AES_CM_128_HMAC_SHA1_80           "AES_CM_128_HMAC_SHA1_80"
 #define F8_128_HMAC_SHA1_80               "F8_128_HMAC_SHA1_80"
 
 /*
  * SDP_SRTP_MAX_KEY_SIZE_BYTES
--- a/media/webrtc/signaling/src/sipcc/core/sdp/sdp_attr.c
+++ b/media/webrtc/signaling/src/sipcc/core/sdp/sdp_attr.c
@@ -203,17 +203,18 @@ sdp_result_e sdp_build_attribute (sdp_t 
             if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
                 SDP_WARN("%s Invalid attribute type to build (%u)", 
                          sdp_p->debug_str, attr_p->type);
             }
         } else {
             result = sdp_attr[attr_p->type].build_func(sdp_p, attr_p, 
                                                        ptr, (u16)(endbuf_p - *ptr));
             /* If we ran out of buffer space, though, we must error out */
-            MOZ_ASSERT(endbuf_p - *ptr > 0);
+            /* FIX - re-enable this assert after we check the results from snprintfs in the build_funcs */
+            /* MOZ_ASSERT(endbuf_p - *ptr > 0); */
             if (endbuf_p - *ptr <= 0)
                 return (SDP_POTENTIAL_SDP_OVERFLOW);
 
             if (result == SDP_SUCCESS) {
                 if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) {
                     SDP_PRINT("%s Built a=%s attribute line", sdp_p->debug_str,
                               sdp_get_attr_name(attr_p->type));
                 }
@@ -3870,17 +3871,18 @@ sdp_result_e sdp_build_attr_cpar (sdp_t 
             SDP_WARN("%s Invalid attribute type to build (%u)", 
                      sdp_p->debug_str, attr_p->type);
         } else {
             *ptr += snprintf(*ptr, MAX((endbuf_p - *ptr), 0), "a=%s: ", cpar_name);
 
             result = sdp_attr[attr_p->type].build_func(sdp_p, attr_p, 
                                                        ptr, (u16)(endbuf_p - *ptr));
             /* If we ran out of buffer space, though, we must error out */
-            MOZ_ASSERT(endbuf_p - *ptr > 0);
+            /* FIX - re-enable this assert after we check the result from snprintf above */
+            /* MOZ_ASSERT(endbuf_p - *ptr > 0); */
             if (endbuf_p - *ptr <= 0)
                 return (SDP_POTENTIAL_SDP_OVERFLOW);
 
             if (result == SDP_SUCCESS) {
                 if (sdp_p->debug_flag[SDP_DEBUG_TRACE]) {
                     SDP_PRINT("%s Built %s a=%s attribute line",
                               sdp_p->debug_str, cpar_name,
                               sdp_get_attr_name(attr_p->type));
--- a/media/webrtc/signaling/src/sipcc/core/sipstack/ccsip_sdp.c
+++ b/media/webrtc/signaling/src/sipcc/core/sipstack/ccsip_sdp.c
@@ -427,23 +427,23 @@ sipsdp_write_to_buf (cc_sdp_t *sdp_info,
     sdp_buf = buf;
 
     if ((rc = sdp_build(sdp_info->src_sdp, &sdp_buf, CCSIP_SDP_BUF_SIZE))
         != SDP_SUCCESS) {
         CCSIP_DEBUG_TASK(DEB_F_PREFIX"sdp_build rc=%s\n", DEB_F_PREFIX_ARGS(SIP_SDP, fname),
                          sdp_get_result_name(rc));
 
         if (rc == SDP_POTENTIAL_SDP_OVERFLOW) {
-            /* SDP may have been truncated. Issue a warning and continue. */
+            /* SDP may have been truncated. Issue an extra warning and abort */
             CCSIP_DEBUG_ERROR(SIP_F_PREFIX"Build SDP buffer overflow\n", fname);
-        } else {
-            cpr_free(buf);
-            *retbytes = 0;
-            return (NULL);
         }
+
+        cpr_free(buf);
+        *retbytes = 0;
+        return (NULL);
     }
 
     /*
      * Compute length of SDP
      */
     sdp_len = sdp_buf - buf;
     /*
      * Minimize the memory impact on the SDP buffer by reallocating buffer
--- a/media/webrtc/signaling/src/sipcc/core/sipstack/h/ccsip_sdp.h
+++ b/media/webrtc/signaling/src/sipcc/core/sipstack/h/ccsip_sdp.h
@@ -42,17 +42,17 @@
 
 
 #include "cpr_types.h"
 #include "pmhutils.h"
 #include "sdp.h"
 #include "ccapi.h"
 
 // RAMC-start
-#define CCSIP_SDP_BUF_SIZE      2048
+#define CCSIP_SDP_BUF_SIZE      SDP_MAX_LEN
 
 /* SDP bitmask values */
 #define CCSIP_SRC_SDP_BIT       0x1
 #define CCSIP_DEST_SDP_BIT      0x2
 
 /*
  * Create a description or a SIP SDP (sip_info) with
  * appropriate values initialized