Changeset 3498


Ignore:
Timestamp:
Apr 6, 2011 7:01:55 AM (14 years ago)
Author:
bennylp
Message:

Re #1186: fixed crash when parsing fmtp with more than 8 parameters by enlarging the default limit, fix the crash, and make the limit configurable

Location:
pjproject/branches/projects/2.0-dev/pjmedia
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/2.0-dev/pjmedia/include/pjmedia/codec.h

    r3199 r3498  
    241241} pjmedia_codec_info; 
    242242 
    243 #define PJMEDIA_CODEC_MAX_FMTP_CNT  8 
    244  
    245243/**  
    246244 * Structure of codec specific parameters which contains name=value pairs. 
  • pjproject/branches/projects/2.0-dev/pjmedia/include/pjmedia/config.h

    r3451 r3498  
    569569 
    570570/** 
     571 * Maximum number of parameters in SDP fmtp attribute. 
     572 * 
     573 * Default: 16 
     574 */ 
     575#ifndef PJMEDIA_CODEC_MAX_FMTP_CNT 
     576#   define PJMEDIA_CODEC_MAX_FMTP_CNT           16 
     577#endif 
     578 
     579 
     580/** 
    571581 * This specifies the behavior of the SDP negotiator when responding to an 
    572582 * offer, whether it should rather use the codec preference as set by 
  • pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/stream_common.c

    r3419 r3498  
    1818 */ 
    1919#include <pjmedia/stream_common.h> 
     20#include <pj/log.h> 
     21 
     22#define THIS_FILE       "stream_common.c" 
    2023 
    2124/* 
     
    5659    while (p < p_end) { 
    5760        char *token, *start, *end; 
     61 
     62        if (fmtp->cnt >= PJMEDIA_CODEC_MAX_FMTP_CNT) { 
     63            PJ_LOG(4,(THIS_FILE, 
     64                      "Warning: fmtp parameter count exceeds " 
     65                      "PJMEDIA_CODEC_MAX_FMTP_CNT")); 
     66            return PJ_SUCCESS; 
     67        } 
    5868 
    5969        /* Skip whitespaces */ 
Note: See TracChangeset for help on using the changeset viewer.