Changeset 1955 for pjproject/trunk


Ignore:
Timestamp:
May 13, 2008 7:24:45 PM (17 years ago)
Author:
nanang
Message:

Resample port get frame may cause buffer overflow when downport returns non-audio frame

File:
1 edited

Legend:

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

    r1266 r1955  
    186186        frame->type = tmp_frame.type; 
    187187        frame->timestamp = tmp_frame.timestamp; 
    188         frame->size = tmp_frame.size; 
     188        /* Copy whatever returned as long as the buffer size is enough */ 
     189        frame->size = tmp_frame.size < rport->base.info.bytes_per_frame ? 
     190                      tmp_frame.size : rport->base.info.bytes_per_frame; 
    189191        if (tmp_frame.size) 
    190             pj_memcpy(frame->buf, tmp_frame.buf, tmp_frame.size); 
     192            pjmedia_copy_samples(frame->buf, tmp_frame.buf, frame->size >> 1); 
    191193        return PJ_SUCCESS; 
    192194    } 
Note: See TracChangeset for help on using the changeset viewer.