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

Side by Side Diff: webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc

Issue 2566383003: VP8DecoderImpl: Fix uninitialized memory crash (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 Release(); 1073 Release();
1074 } 1074 }
1075 1075
1076 int VP8DecoderImpl::InitDecode(const VideoCodec* inst, int number_of_cores) { 1076 int VP8DecoderImpl::InitDecode(const VideoCodec* inst, int number_of_cores) {
1077 int ret_val = Release(); 1077 int ret_val = Release();
1078 if (ret_val < 0) { 1078 if (ret_val < 0) {
1079 return ret_val; 1079 return ret_val;
1080 } 1080 }
1081 if (decoder_ == NULL) { 1081 if (decoder_ == NULL) {
1082 decoder_ = new vpx_codec_ctx_t; 1082 decoder_ = new vpx_codec_ctx_t;
1083 memset(decoder_, 0, sizeof(*decoder_));
1083 } 1084 }
1084 if (inst && inst->codecType == kVideoCodecVP8) { 1085 if (inst && inst->codecType == kVideoCodecVP8) {
1085 feedback_mode_ = inst->VP8().feedbackModeOn; 1086 feedback_mode_ = inst->VP8().feedbackModeOn;
1086 } 1087 }
1087 vpx_codec_dec_cfg_t cfg; 1088 vpx_codec_dec_cfg_t cfg;
1088 // Setting number of threads to a constant value (1) 1089 // Setting number of threads to a constant value (1)
1089 cfg.threads = 1; 1090 cfg.threads = 1;
1090 cfg.h = cfg.w = 0; // set after decode 1091 cfg.h = cfg.w = 0; // set after decode
1091 1092
1092 vpx_codec_flags_t flags = 0; 1093 vpx_codec_flags_t flags = 0;
1093 #if !defined(WEBRTC_ARCH_ARM) && !defined(WEBRTC_ARCH_ARM64) && \ 1094 #if !defined(WEBRTC_ARCH_ARM) && !defined(WEBRTC_ARCH_ARM64) && \
1094 !defined(ANDROID) 1095 !defined(ANDROID)
1095 flags = VPX_CODEC_USE_POSTPROC; 1096 flags = VPX_CODEC_USE_POSTPROC;
1096 #endif 1097 #endif
1097 1098
1098 if (vpx_codec_dec_init(decoder_, vpx_codec_vp8_dx(), &cfg, flags)) { 1099 if (vpx_codec_dec_init(decoder_, vpx_codec_vp8_dx(), &cfg, flags)) {
1100 delete decoder_;
1101 decoder_ = nullptr;
1099 return WEBRTC_VIDEO_CODEC_MEMORY; 1102 return WEBRTC_VIDEO_CODEC_MEMORY;
1100 } 1103 }
1101 1104
1102 // Save VideoCodec instance for later; mainly for duplicating the decoder. 1105 // Save VideoCodec instance for later; mainly for duplicating the decoder.
1103 if (&codec_ != inst) 1106 if (&codec_ != inst)
1104 codec_ = *inst; 1107 codec_ = *inst;
1105 propagation_cnt_ = -1; 1108 propagation_cnt_ = -1;
1106 1109
1107 inited_ = true; 1110 inited_ = true;
1108 1111
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 return -1; 1337 return -1;
1335 } 1338 }
1336 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) != 1339 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) !=
1337 VPX_CODEC_OK) { 1340 VPX_CODEC_OK) {
1338 return -1; 1341 return -1;
1339 } 1342 }
1340 return 0; 1343 return 0;
1341 } 1344 }
1342 1345
1343 } // namespace webrtc 1346 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698