History

hevc: Always consider VLC NALU type mismatch fatal

Luca Barbato committed 12 years ago

Commit 521726f1 parent 175e5061 file · +16 −14Browse files

Unified · Split

libavcodec/hevc.c+16−14
@@ -2521,9 +2521,7 @@ static int decode_nal_unit(HEVCContext *s, const uint8_t *nal, int length) · 2520 unmodified lines
2521 if (ret < 0) {2521 if (ret < 0) {
2522 av_log(s->avctx, AV_LOG_ERROR, "Invalid NAL unit %d, skipping.\n",2522 av_log(s->avctx, AV_LOG_ERROR, "Invalid NAL unit %d, skipping.\n",
2523 s->nal_unit_type);2523 s->nal_unit_type);
2524 if (s->avctx->err_recognition & AV_EF_EXPLODE)2524 goto fail;
2525 return ret;
2526 return 0;
2527 } else if (!ret)2525 } else if (!ret)
2528 return 0;2526 return 0;
2529 2527
@@ -2531,23 +2529,23 @@ static int decode_nal_unit(HEVCContext *s, const uint8_t *nal, int length) · 1 unmodified line
2531 case NAL_VPS:2529 case NAL_VPS:
2532 ret = ff_hevc_decode_nal_vps(s);2530 ret = ff_hevc_decode_nal_vps(s);
2533 if (ret < 0)2531 if (ret < 0)
2534 return ret;2532 goto fail;
2535 break;2533 break;
2536 case NAL_SPS:2534 case NAL_SPS:
2537 ret = ff_hevc_decode_nal_sps(s);2535 ret = ff_hevc_decode_nal_sps(s);
2538 if (ret < 0)2536 if (ret < 0)
2539 return ret;2537 goto fail;
2540 break;2538 break;
2541 case NAL_PPS:2539 case NAL_PPS:
2542 ret = ff_hevc_decode_nal_pps(s);2540 ret = ff_hevc_decode_nal_pps(s);
2543 if (ret < 0)2541 if (ret < 0)
2544 return ret;2542 goto fail;
2545 break;2543 break;
2546 case NAL_SEI_PREFIX:2544 case NAL_SEI_PREFIX:
2547 case NAL_SEI_SUFFIX:2545 case NAL_SEI_SUFFIX:
2548 ret = ff_hevc_decode_nal_sei(s);2546 ret = ff_hevc_decode_nal_sei(s);
2549 if (ret < 0)2547 if (ret < 0)
2550 return ret;2548 goto fail;
2551 break;2549 break;
2552 case NAL_TRAIL_R:2550 case NAL_TRAIL_R:
2553 case NAL_TRAIL_N:2551 case NAL_TRAIL_N:
@@ -2593,7 +2591,7 @@ static int decode_nal_unit(HEVCContext *s, const uint8_t *nal, int length) · 39 unmodified lines
2593 return ret;2591 return ret;
2594 } else if (!s->ref) {2592 } else if (!s->ref) {
2595 av_log(s->avctx, AV_LOG_ERROR, "First slice in a frame missing.\n");2593 av_log(s->avctx, AV_LOG_ERROR, "First slice in a frame missing.\n");
2596 return AVERROR_INVALIDDATA;2594 goto fail;
2597 }2595 }
2598 2596
2599 if (s->nal_unit_type != s->first_nal_type) {2597 if (s->nal_unit_type != s->first_nal_type) {
@@ -2609,8 +2607,7 @@ static int decode_nal_unit(HEVCContext *s, const uint8_t *nal, int length) · 9 unmodified lines
2609 if (ret < 0) {2607 if (ret < 0) {
2610 av_log(s->avctx, AV_LOG_WARNING,2608 av_log(s->avctx, AV_LOG_WARNING,
2611 "Error constructing the reference lists for the current slice.\n");2609 "Error constructing the reference lists for the current slice.\n");
2612 if (s->avctx->err_recognition & AV_EF_EXPLODE)2610 goto fail;
2613 return ret;
2614 }2611 }
2615 }2612 }
2616 2613
@@ -2623,8 +2620,10 @@ static int decode_nal_unit(HEVCContext *s, const uint8_t *nal, int length) · 6 unmodified lines
2623 restore_tqb_pixels(s);2620 restore_tqb_pixels(s);
2624 }2621 }
2625 2622
2626 if (ctb_addr_ts < 0)2623 if (ctb_addr_ts < 0) {
2627 return ctb_addr_ts;2624 ret = ctb_addr_ts;
2625 goto fail;
2626 }
2628 break;2627 break;
2629 case NAL_EOS_NUT:2628 case NAL_EOS_NUT:
2630 case NAL_EOB_NUT:2629 case NAL_EOB_NUT:
@@ -2640,6 +2639,10 @@ static int decode_nal_unit(HEVCContext *s, const uint8_t *nal, int length) · 9 unmodified lines
2640 }2639 }
2641 2640
2642 return 0;2641 return 0;
2642fail:
2643 if (s->avctx->err_recognition & AV_EF_EXPLODE)
2644 return ret;
2645 return 0;
2643}2646}
2644 2647
2645/* FIXME: This is adapted from ff_h264_decode_nal, avoiding duplication2648/* FIXME: This is adapted from ff_h264_decode_nal, avoiding duplication
@@ -2820,8 +2823,7 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length) · 174 unmodified lines
2820 if (ret < 0) {2823 if (ret < 0) {
2821 av_log(s->avctx, AV_LOG_WARNING,2824 av_log(s->avctx, AV_LOG_WARNING,
2822 "Error parsing NAL unit #%d.\n", i);2825 "Error parsing NAL unit #%d.\n", i);
2823 if (s->avctx->err_recognition & AV_EF_EXPLODE)2826 goto fail;
2824 goto fail;
2825 }2827 }
2826 }2828 }
2827 2829

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t