summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-14 00:33:28 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-14 00:42:20 +0100
commit701e9b82547c6fa72acfb91c86bf29c40722f154 (patch)
tree3e27a6ceddd2d75f8f1edb817f0cc087b05f3540 /libavcodec
parentfaf8eca08dcb069e205c720476cad638b36699ef (diff)
h264: Use mb itself as memcpy anchor and assert the other anchors position
This makes the code more robust against reordering or fields. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h264.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 26386b9914..3471e678a2 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1251,9 +1251,10 @@ static int decode_update_thread_context(AVCodecContext *dst,
for (i = 0; i < MAX_PPS_COUNT; i++)
av_freep(h->pps_buffers + i);
- // copy all fields after MpegEnc
+ // copy all fields after MpegEnc, except mb
memcpy(&h->s + 1, &h1->s + 1,
- offsetof(H264Context, intra_gb) - sizeof(MpegEncContext));
+ offsetof(H264Context, mb) - sizeof(MpegEncContext));
+ av_assert0(&h->cabac == &h->mb_padding + 1);
memcpy(&h->cabac, &h1->cabac,
sizeof(H264Context) - offsetof(H264Context, cabac));
memset(h->sps_buffers, 0, sizeof(h->sps_buffers));