[FFmpeg-cvslog] h264: reset the private data in init_thread_copy()

Anton Khirnov git at videolan.org
Sun Apr 5 22:33:57 CEST 2015


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sun Mar 29 12:26:45 2015 +0200| [bd737b5178f361a9b592691848f29a7a79603a7e] | committer: Anton Khirnov

h264: reset the private data in init_thread_copy()

The generic code copies the main context's private data to all the
others. However that is quite dangerous, as it might end up copying some
pointers that are or will become invalid.

Since everything we actually need will be copied later in
update_thread_context(), it's safest to zero the private data in
init_thread_copy(), so it works the same way as init for the main
context.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bd737b5178f361a9b592691848f29a7a79603a7e
---

 libavcodec/h264.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 0b963e4..46c172a 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -677,8 +677,8 @@ static int decode_init_thread_copy(AVCodecContext *avctx)
 
     if (!avctx->internal->is_copy)
         return 0;
-    memset(h->sps_buffers, 0, sizeof(h->sps_buffers));
-    memset(h->pps_buffers, 0, sizeof(h->pps_buffers));
+
+    memset(h, 0, sizeof(*h));
 
     ret = h264_init_context(avctx, h);
     if (ret < 0)



More information about the ffmpeg-cvslog mailing list