Skip to content

Commit 0226b95

Browse files
jan-ivarjzern
authored andcommitted
vp8_de_alloc_frame_buffers: clear mi/postproc_state
This avoids leaving the decoder in an inconsistent state, which can lead to a use-after-free (UAF) through `VP8_COMMON::mi`, `VP8_COMMON::frame_to_show`, and `VP8_COMMON::postproc_state` with `VP8_MFQE` enabled when decoding proceeds after an earlier allocation failure. Bug: 500638476 Change-Id: I0adb05c63db897093df2aa283b51888543a107ea
1 parent e914ae9 commit 0226b95

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

vp8/common/alloccommon.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include "entropymode.h"
1818
#include "systemdependent.h"
1919

20+
// This function frees all frame and post processing buffers, as well as
21+
// indirect references to them via context and mode info allocations.
2022
void vp8_de_alloc_frame_buffers(VP8_COMMON *oci) {
2123
int i;
2224
for (i = 0; i < NUM_YV12_BUFFERS; ++i) {
@@ -34,18 +36,22 @@ void vp8_de_alloc_frame_buffers(VP8_COMMON *oci) {
3436
oci->pp_limits_buffer = NULL;
3537

3638
vpx_free(oci->postproc_state.generated_noise);
37-
oci->postproc_state.generated_noise = NULL;
39+
memset(&oci->postproc_state, 0, sizeof(oci->postproc_state));
3840
#endif
3941

4042
vpx_free(oci->above_context);
4143
vpx_free(oci->mip);
4244
#if CONFIG_ERROR_CONCEALMENT
4345
vpx_free(oci->prev_mip);
4446
oci->prev_mip = NULL;
47+
oci->prev_mi = NULL;
4548
#endif
4649

4750
oci->above_context = NULL;
4851
oci->mip = NULL;
52+
oci->mi = NULL;
53+
oci->show_frame_mi = NULL;
54+
oci->frame_to_show = NULL;
4955
}
5056

5157
int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height) {

0 commit comments

Comments
 (0)