Permalink
Browse files

ffmpeg: xvba, check if buffers are valid before writing

  • Loading branch information...
1 parent 39cf46e commit df7e4063e1132918489b6694b1ad7f632ebf41e2 @FernetMenta committed Jan 7, 2012
Showing with 9 additions and 0 deletions.
  1. +6 −0 lib/ffmpeg/libavcodec/xvba_h264.c
  2. +3 −0 lib/ffmpeg/libavcodec/xvba_vc1.c
@@ -45,6 +45,9 @@ static int start_frame(AVCodecContext *avctx,
render = (struct xvba_render_state *)s->current_picture_ptr->data[0];
assert(render);
+ if (render->picture_descriptor == 0)
+ return -1;
+
pic_descriptor = render->picture_descriptor;
for (i = 0; i < 2; ++i) {
@@ -73,6 +76,9 @@ static int end_frame(AVCodecContext *avctx)
render = (struct xvba_render_state *)s->current_picture_ptr->data[0];
assert(render);
+ if (render->picture_descriptor == 0 || render->iq_matrix == 0)
+ return -1;
+
pic_descriptor = render->picture_descriptor;
iq_matrix = render->iq_matrix;
@@ -58,6 +58,9 @@ static int end_frame(AVCodecContext *avctx)
render = (struct xvba_render_state *)s->current_picture_ptr->data[0];
assert(render);
+ if (render->picture_descriptor == 0 || render->iq_matrix == 0)
+ return -1;
+
pic_descriptor = render->picture_descriptor;
av_dlog(avctx, "xvba_vc1_end_frame()\n");

0 comments on commit df7e406

Please sign in to comment.