Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: chromium/patches/to_upstream/39_VP8_fix_oob_read_writes.patch

Issue 9290059: Initial commit of all previous Chrome build scripts. (Closed) Base URL: http://git.chromium.org/chromium/third_party/ffmpeg.git@master
Patch Set: Drop deprecated subfolder. Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 Index: a/libavcodec/vp8.c
2 ===================================================================
3 --- a/libavcodec/vp8.c (revision 105133)
4 +++ b/libavcodec/vp8.c (working copy)
5 @@ -33,6 +33,19 @@
6 # include "arm/vp8.h"
7 #endif
8
9 +static void free_buffers(VP8Context *s)
10 +{
11 + av_freep(&s->macroblocks_base);
12 + av_freep(&s->filter_strength);
13 + av_freep(&s->intra4x4_pred_mode_top);
14 + av_freep(&s->top_nnz);
15 + av_freep(&s->edge_emu_buffer);
16 + av_freep(&s->top_border);
17 + av_freep(&s->segmentation_map);
18 +
19 + s->macroblocks = NULL;
20 +}
21 +
22 static void vp8_decode_flush(AVCodecContext *avctx)
23 {
24 VP8Context *s = avctx->priv_data;
25 @@ -45,15 +58,7 @@
26 }
27 memset(s->framep, 0, sizeof(s->framep));
28
29 - av_freep(&s->macroblocks_base);
30 - av_freep(&s->filter_strength);
31 - av_freep(&s->intra4x4_pred_mode_top);
32 - av_freep(&s->top_nnz);
33 - av_freep(&s->edge_emu_buffer);
34 - av_freep(&s->top_border);
35 - av_freep(&s->segmentation_map);
36 -
37 - s->macroblocks = NULL;
38 + free_buffers(s);
39 }
40
41 static int update_dimensions(VP8Context *s, int width, int height)
42 @@ -273,7 +278,7 @@
43
44 if (!s->macroblocks_base || /* first frame */
45 width != s->avctx->width || height != s->avctx->height) {
46 - if ((ret = update_dimensions(s, width, height) < 0))
47 + if ((ret = update_dimensions(s, width, height)) < 0)
48 return ret;
49 }
50
51 @@ -487,6 +492,7 @@
52
53 AV_ZERO32(&near_mv[0]);
54 AV_ZERO32(&near_mv[1]);
55 + AV_ZERO32(&near_mv[2]);
56
57 /* Process MB on top, left and top-left */
58 #define MV_EDGE_CHECK(n)\
59 @@ -1749,6 +1755,11 @@
60 {
61 VP8Context *s = dst->priv_data, *s_src = src->priv_data;
62
63 + if (s->macroblocks_base &&
64 + (s_src->mb_width != s->mb_width || s_src->mb_height != s->mb_height)) {
65 + free_buffers(s);
66 + }
67 +
68 s->prob[0] = s_src->prob[!s_src->update_probabilities];
69 s->segmentation = s_src->segmentation;
70 s->lf_delta = s_src->lf_delta;
71 Index: a/libavcodec/pthread.c
72 ===================================================================
73 --- a/libavcodec/pthread.c (revision 105133)
74 +++ b/libavcodec/pthread.c (working copy)
75 @@ -332,6 +332,9 @@
76 dst->height = src->height;
77 dst->pix_fmt = src->pix_fmt;
78
79 + dst->coded_width = src->coded_width;
80 + dst->coded_height = src->coded_height;
81 +
82 dst->has_b_frames = src->has_b_frames;
83 dst->idct_algo = src->idct_algo;
84 dst->slice_count = src->slice_count;
85 @@ -630,7 +633,7 @@
86
87 park_frame_worker_threads(fctx, thread_count);
88
89 - if (fctx->prev_thread)
90 + if (fctx->prev_thread && fctx->prev_thread != fctx->threads)
91 update_context_from_thread(fctx->threads->avctx, fctx->prev_thread->avc tx, 0);
92
93 fctx->die = 1;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698