Revision 0d3ee135 libavformat/nutdec.c

View differences:

libavformat/nutdec.c
215 215
        GET_V(nut->time_base[i].den, tmp>0 && tmp<(1ULL<<31))
216 216
        if(av_gcd(nut->time_base[i].num, nut->time_base[i].den) != 1){
217 217
            av_log(s, AV_LOG_ERROR, "time base invalid\n");
218
            return -1;
218
            return AVERROR_INVALIDDATA;
219 219
        }
220 220
    }
221 221
    tmp_pts=0;
......
243 243

  
244 244
        if(count == 0 || i+count > 256){
245 245
            av_log(s, AV_LOG_ERROR, "illegal count %d at %d\n", count, i);
246
            return -1;
246
            return AVERROR_INVALIDDATA;
247 247
        }
248 248
        if(tmp_stream >= stream_count){
249 249
            av_log(s, AV_LOG_ERROR, "illegal stream number\n");
250
            return -1;
250
            return AVERROR_INVALIDDATA;
251 251
        }
252 252

  
253 253
        for(j=0; j<count; j++,i++){
......
276 276
            rem -= nut->header_len[i];
277 277
            if(rem < 0){
278 278
                av_log(s, AV_LOG_ERROR, "invalid elision header\n");
279
                return -1;
279
                return AVERROR_INVALIDDATA;
280 280
            }
281 281
            nut->header[i]= av_malloc(nut->header_len[i]);
282 282
            get_buffer(bc, nut->header[i], nut->header_len[i]);
......
286 286

  
287 287
    if(skip_reserved(bc, end) || get_checksum(bc)){
288 288
        av_log(s, AV_LOG_ERROR, "main header checksum mismatch\n");
289
        return -1;
289
        return AVERROR_INVALIDDATA;
290 290
    }
291 291

  
292 292
    nut->stream = av_mallocz(sizeof(StreamContext)*stream_count);
......
615 615
        pos= find_startcode(bc, MAIN_STARTCODE, pos)+1;
616 616
        if (pos<0+1){
617 617
            av_log(s, AV_LOG_ERROR, "No main startcode found.\n");
618
            return -1;
618
            return AVERROR_INVALIDDATA;
619 619
        }
620 620
    }while(decode_main_header(nut) < 0);
621 621

  
......
625 625
        pos= find_startcode(bc, STREAM_STARTCODE, pos)+1;
626 626
        if (pos<0+1){
627 627
            av_log(s, AV_LOG_ERROR, "Not all stream headers found.\n");
628
            return -1;
628
            return AVERROR_INVALIDDATA;
629 629
        }
630 630
        if(decode_stream_header(nut) >= 0)
631 631
            initialized_stream_count++;
......
639 639

  
640 640
        if(startcode==0){
641 641
            av_log(s, AV_LOG_ERROR, "EOF before video frames\n");
642
            return -1;
642
            return AVERROR_INVALIDDATA;
643 643
        }else if(startcode == SYNCPOINT_STARTCODE){
644 644
            nut->next_startcode= startcode;
645 645
            break;
......
673 673

  
674 674
    if(url_ftell(bc) > nut->last_syncpoint_pos + nut->max_distance){
675 675
        av_log(s, AV_LOG_ERROR, "Last frame must have been damaged %"PRId64" > %"PRId64" + %d\n", url_ftell(bc), nut->last_syncpoint_pos, nut->max_distance);
676
        return -1;
676
        return AVERROR_INVALIDDATA;
677 677
    }
678 678

  
679 679
    flags          = nut->frame_code[frame_code].flags;
......
685 685
    *header_idx    = nut->frame_code[frame_code].header_idx;
686 686

  
687 687
    if(flags & FLAG_INVALID)
688
        return -1;
688
        return AVERROR_INVALIDDATA;
689 689
    if(flags & FLAG_CODED)
690 690
        flags ^= ff_get_v(bc);
691 691
    if(flags & FLAG_STREAM_ID){
......
715 715

  
716 716
    if(*header_idx >= (unsigned)nut->header_count){
717 717
        av_log(s, AV_LOG_ERROR, "header_idx invalid\n");
718
        return -1;
718
        return AVERROR_INVALIDDATA;
719 719
    }
720 720
    if(size > 4096)
721 721
        *header_idx=0;
......
725 725
        get_be32(bc); //FIXME check this
726 726
    }else if(size > 2*nut->max_distance || FFABS(stc->last_pts - *pts) > stc->max_pts_distance){
727 727
        av_log(s, AV_LOG_ERROR, "frame size > 2max_distance and no checksum\n");
728
        return -1;
728
        return AVERROR_INVALIDDATA;
729 729
    }
730 730

  
731 731
    stc->last_pts= *pts;
......
744 744

  
745 745
    size= decode_frame_header(nut, &pts, &stream_id, &header_idx, frame_code);
746 746
    if(size < 0)
747
        return -1;
747
        return size;
748 748

  
749 749
    stc= &nut->stream[stream_id];
750 750

  
......
824 824
av_log(s, AV_LOG_DEBUG, "syncing from %"PRId64"\n", pos);
825 825
            tmp= find_any_startcode(bc, nut->last_syncpoint_pos+1);
826 826
            if(tmp==0)
827
                return -1;
827
                return AVERROR_INVALIDDATA;
828 828
av_log(s, AV_LOG_DEBUG, "sync\n");
829 829
            nut->next_startcode= tmp;
830 830
        }

Also available in: Unified diff