diff mbox

[FFmpeg-devel] avcodec/h264_refs: reset MMCO when invalid mmco code is found

Message ID CAB0OVGoeM2mXQnaXKmZ9sGg5Ys8nyUOR-gASo5VUm4s0qOihRA@mail.gmail.com
State Rejected
Headers show

Commit Message

Carl Eugen Hoyos Dec. 7, 2018, 1:06 p.m. UTC
2018-12-06 15:26 GMT+01:00, Paul B Mahol <onemda@gmail.com>:
> This recovers state with #7374 linked sample.
>
> Work funded by Open Broadcast Systems.
>
> Signed-off-by: Paul B Mahol <onemda@gmail.com>
> ---
>  libavcodec/h264_refs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
> index eaf965e43d..5645a203a7 100644
> --- a/libavcodec/h264_refs.c
> +++ b/libavcodec/h264_refs.c
> @@ -718,6 +718,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h)
>              }
>              break;
>          case MMCO_RESET:
> +        default:
>              while (h->short_ref_count) {
>                  remove_short(h, h->short_ref[0]->frame_num, 0);
>              }
> @@ -730,7 +731,6 @@ int ff_h264_execute_ref_pic_marking(H264Context *h)
>              for (j = 0; j < MAX_DELAYED_PIC_COUNT; j++)
>                  h->last_pocs[j] = INT_MIN;
>              break;
> -        default: assert(0);
>          }
>      }
>

Alternative is to avoid an invalid mmco opcode.

Carl Eugen
diff mbox

Patch

diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
index eaf965e..c7e64ec 100644
--- a/libavcodec/h264_refs.c
+++ b/libavcodec/h264_refs.c
@@ -875,6 +875,7 @@ 
                     av_log(logctx, AV_LOG_ERROR,
                            "illegal memory management control operation %d\n",
                            opcode);
+                    mmco[i].opcode = MMCO_RESET;
                     return -1;
                 }
                 if (opcode == MMCO_END)