Revision 05219463 libavformat/asf.c

View differences:

libavformat/asf.c
244 244
                //       asf_st->ds_data_size, asf_st->ds_span, asf_st->ds_silence_data);
245 245
                if (asf_st->ds_span > 1) {
246 246
                    if (!asf_st->ds_chunk_size
247
                        || (asf_st->ds_packet_size/asf_st->ds_chunk_size <= 1))
247
                        || (asf_st->ds_packet_size/asf_st->ds_chunk_size <= 1)
248
                        || asf_st->ds_packet_size % asf_st->ds_chunk_size)
248 249
                        asf_st->ds_span = 0; // disable descrambling
249 250
                }
250 251
                switch (st->codec->codec_id) {
......
702 703
        if (asf_st->frag_offset == asf_st->pkt.size) {
703 704
            /* return packet */
704 705
            if (asf_st->ds_span > 1) {
706
              if(asf_st->pkt.size != asf_st->ds_packet_size * asf_st->ds_span){
707
                    av_log(s, AV_LOG_ERROR, "pkt.size != ds_packet_size * ds_span\n");
708
              }else{
705 709
                /* packet descrambling */
706 710
                uint8_t *newdata = av_malloc(asf_st->pkt.size);
707 711
                if (newdata) {
......
712 716
                        int col = off % asf_st->ds_span;
713 717
                        int idx = row + col * asf_st->ds_packet_size / asf_st->ds_chunk_size;
714 718
                        //printf("off:%d  row:%d  col:%d  idx:%d\n", off, row, col, idx);
719

  
720
                        assert(offset + asf_st->ds_chunk_size <= asf_st->pkt.size);
721
                        assert(idx+1 <= asf_st->pkt.size / asf_st->ds_chunk_size);
715 722
                        memcpy(newdata + offset,
716 723
                               asf_st->pkt.data + idx * asf_st->ds_chunk_size,
717 724
                               asf_st->ds_chunk_size);
......
720 727
                    av_free(asf_st->pkt.data);
721 728
                    asf_st->pkt.data = newdata;
722 729
                }
730
              }
723 731
            }
724 732
            asf_st->frag_offset = 0;
725 733
            *pkt= asf_st->pkt;

Also available in: Unified diff