Changeset 4926 for pjproject


Ignore:
Timestamp:
Sep 22, 2014 7:08:14 AM (10 years ago)
Author:
riza
Message:

Fixed #1791: Fixed possible crash when trying to cancel sdp negotiation upon receiving UPDATE response.

Location:
pjproject/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/sdp_neg.c

    r4872 r4926  
    14011401    neg->has_remote_answer = PJ_FALSE; 
    14021402 
    1403     if (neg->state == PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER) { 
     1403    if (neg->state == PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER && 
     1404        neg->active_local_sdp)  
     1405    { 
    14041406        /* Increment next version number. This happens if for example 
    14051407         * the reinvite offer is rejected by 488. If we don't increment 
  • pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c

    r4924 r4926  
    163163    pj_str_t             done_tag;  /* To tag in RX response with answer    */ 
    164164    pj_bool_t            done_early;/* Negotiation was done for early med?  */ 
     165    pj_bool_t            has_sdp;   /* Message with SDP?                    */ 
    165166}; 
    166167 
     
    712713        } 
    713714    } 
     715} 
     716 
     717/*  
     718 * Check if tx_data has sdp.  
     719 */ 
     720static pj_bool_t tx_data_has_sdp(const pjsip_tx_data *tdata) 
     721{ 
     722    pjsip_msg_body *body = tdata->msg->body; 
     723    pjsip_media_type app_sdp; 
     724 
     725    PJ_ASSERT_RETURN(tdata, PJ_FALSE); 
     726 
     727    pjsip_media_type_init2(&app_sdp, "application", "sdp"); 
     728 
     729    if (body && 
     730        pj_stricmp(&body->content_type.type, &app_sdp.type)==0 &&  
     731        pj_stricmp(&body->content_type.subtype, &app_sdp.subtype)==0)  
     732    { 
     733        return PJ_TRUE; 
     734 
     735    } else if (body &&  
     736               pj_stricmp2(&body->content_type.type, "multipart") &&  
     737               (pj_stricmp2(&body->content_type.subtype, "mixed")==0 || 
     738                pj_stricmp2(&body->content_type.subtype, "alternative")==0))     
     739    { 
     740        pjsip_multipart_part *part; 
     741 
     742        part = pjsip_multipart_find_part(body, &app_sdp, NULL); 
     743        if (part) { 
     744            return PJ_TRUE; 
     745        } 
     746    } 
     747 
     748    return PJ_FALSE; 
    714749} 
    715750 
     
    14961531    tsx_inv_data = PJ_POOL_ZALLOC_T(inv->invite_tsx->pool, struct tsx_inv_data); 
    14971532    tsx_inv_data->inv = inv; 
     1533    tsx_inv_data->has_sdp = (sdp_info->sdp!=NULL); 
    14981534    inv->invite_tsx->mod_data[mod_inv.mod.id] = tsx_inv_data; 
    14991535 
     
    18521888        tsx_inv_data = PJ_POOL_ZALLOC_T(tsx->pool, struct tsx_inv_data); 
    18531889        tsx_inv_data->inv = inv; 
     1890        tsx_inv_data->has_sdp = (sdp_info->sdp!=NULL); 
    18541891        tsx->mod_data[mod_inv.mod.id] = tsx_inv_data; 
    18551892    } 
     
    30593096        tsx_inv_data = PJ_POOL_ZALLOC_T(inv->pool, struct tsx_inv_data); 
    30603097        tsx_inv_data->inv = inv; 
     3098        tsx_inv_data->has_sdp = tx_data_has_sdp(tdata); 
    30613099 
    30623100        pjsip_dlg_dec_lock(inv->dlg); 
     
    34943532                PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER && 
    34953533        tsx_inv_data && tsx_inv_data->sdp_done == PJ_FALSE && 
    3496         !tsx_inv_data->retrying) 
     3534        !tsx_inv_data->retrying && tsx_inv_data->has_sdp) 
    34973535    { 
    34983536        pjmedia_sdp_neg_cancel_offer(inv->neg); 
     
    35703608                                            struct tsx_inv_data); 
    35713609            tsx_inv_data->inv = inv; 
     3610            tsx_inv_data->has_sdp = PJ_TRUE; 
    35723611            inv->invite_tsx->mod_data[mod_inv.mod.id] = tsx_inv_data; 
    35733612        } 
Note: See TracChangeset for help on using the changeset viewer.