[FFmpeg-trac] #5543(avcodec:new): av_packet_ref incorrectly processes packets with offset between data and buffer

FFmpeg trac at avcodec.org
Thu May 12 13:11:51 CEST 2016


#5543: av_packet_ref incorrectly processes packets with offset between data and
buffer
------------------------------------+-----------------------------------
             Reporter:  mrlika      |                    Owner:
                 Type:  defect      |                   Status:  new
             Priority:  normal      |                Component:  avcodec
              Version:  git-master  |               Resolution:
             Keywords:              |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+-----------------------------------

Comment (by mrlika):

 Source code to reproduce:

 {{{
 static void testcase_for_av_packet_ref(void) {
     AVPacket *src = av_packet_alloc();
     AVPacket *dst = av_packet_alloc();

     av_new_packet(src, 32); /* Allocate payload 32 bytes */

     assert(src->data == src->buf->data);
     assert(src->size == 32);
     assert(src->buf->size == 32 + AV_INPUT_BUFFER_PADDING_SIZE);

     /* Doing payload offset by 16 bytes. Buffer remains the same */
     src->data += 16;
     src->size -= 16;

     av_packet_ref(dst, src);

     assert(dst->size == src->size);
     assert(dst->data == src->data); /* This fails */
 }

 static void testcase_for_av_packet_clone(void) {
     AVPacket *src = av_packet_alloc();
     AVPacket *dst;

     av_new_packet(src, 32); /* Allocate payload 32 bytes */

     assert(src->data == src->buf->data);
     assert(src->size == 32);
     assert(src->buf->size == 32 + AV_INPUT_BUFFER_PADDING_SIZE);

     /* Doing payload offset by 16 bytes. Buffer remains the same */
     src->data += 16;
     src->size -= 16;

     dst = av_packet_clone(src);

     assert(dst->size == src->size);
     assert(dst->data == src->data); /* This fails */
 }
 }}}

--
Ticket URL: <https://trac.ffmpeg.org/ticket/5543#comment:6>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list