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
25212521 if (ret < 0) {
25222522 av_log(s->avctx, AV_LOG_ERROR, "Invalid NAL unit %d, skipping.\n",
25232523 s->nal_unit_type);
2524− if (s->avctx->err_recognition & AV_EF_EXPLODE)
2525− return ret;
2526− return 0;
2524+ goto fail;
25272525 } else if (!ret)
25282526 return 0;
25292527
@@ -2531,23 +2529,23 @@ static int decode_nal_unit(HEVCContext *s, const uint8_t *nal, int length) · 1 unmodified line
25312529 case NAL_VPS:
25322530 ret = ff_hevc_decode_nal_vps(s);
25332531 if (ret < 0)
2534− return ret;
2532+ goto fail;
25352533 break;
25362534 case NAL_SPS:
25372535 ret = ff_hevc_decode_nal_sps(s);
25382536 if (ret < 0)
2539− return ret;
2537+ goto fail;
25402538 break;
25412539 case NAL_PPS:
25422540 ret = ff_hevc_decode_nal_pps(s);
25432541 if (ret < 0)
2544− return ret;
2542+ goto fail;
25452543 break;
25462544 case NAL_SEI_PREFIX:
25472545 case NAL_SEI_SUFFIX:
25482546 ret = ff_hevc_decode_nal_sei(s);
25492547 if (ret < 0)
2550− return ret;
2548+ goto fail;
25512549 break;
25522550 case NAL_TRAIL_R:
25532551 case NAL_TRAIL_N:
@@ -2593,7 +2591,7 @@ static int decode_nal_unit(HEVCContext *s, const uint8_t *nal, int length) · 39 unmodified lines
25932591 return ret;
25942592 } else if (!s->ref) {
25952593 av_log(s->avctx, AV_LOG_ERROR, "First slice in a frame missing.\n");
2596− return AVERROR_INVALIDDATA;
2594+ goto fail;
25972595 }
25982596
25992597 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
26092607 if (ret < 0) {
26102608 av_log(s->avctx, AV_LOG_WARNING,
26112609 "Error constructing the reference lists for the current slice.\n");
2612− if (s->avctx->err_recognition & AV_EF_EXPLODE)
2613− return ret;
2610+ goto fail;
26142611 }
26152612 }
26162613
@@ -2623,8 +2620,10 @@ static int decode_nal_unit(HEVCContext *s, const uint8_t *nal, int length) · 6 unmodified lines
26232620 restore_tqb_pixels(s);
26242621 }
26252622
2626− if (ctb_addr_ts < 0)
2627− return ctb_addr_ts;
2623+ if (ctb_addr_ts < 0) {
2624+ ret = ctb_addr_ts;
2625+ goto fail;
2626+ }
26282627 break;
26292628 case NAL_EOS_NUT:
26302629 case NAL_EOB_NUT:
@@ -2640,6 +2639,10 @@ static int decode_nal_unit(HEVCContext *s, const uint8_t *nal, int length) · 9 unmodified lines
26402639 }
26412640
26422641 return 0;
2642+fail:
2643+ if (s->avctx->err_recognition & AV_EF_EXPLODE)
2644+ return ret;
2645+ return 0;
26432646 }
26442647
26452648 /* 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
28202823 if (ret < 0) {
28212824 av_log(s->avctx, AV_LOG_WARNING,
28222825 "Error parsing NAL unit #%d.\n", i);
2823− if (s->avctx->err_recognition & AV_EF_EXPLODE)
2824− goto fail;
2826+ goto fail;
28252827 }
28262828 }
28272829

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