From 9e9cc72b53c956284fd2aaa7d57ff7e2077e38f9 Mon Sep 17 00:00:00 2001 From: "mikhal@webrtc.org" Date: Wed, 14 Nov 2012 17:56:46 +0000 Subject: [PATCH] Relanding r3071 - updates for i420: Making sure that decoded frame is complete and buffer size is sufficient. Re-landing is possible following r3094 - which disabled a problematic test. Review URL: https://webrtc-codereview.appspot.com/939019 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3097 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../modules/video_coding/codecs/i420/main/source/i420.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/webrtc/modules/video_coding/codecs/i420/main/source/i420.cc b/webrtc/modules/video_coding/codecs/i420/main/source/i420.cc index f5831823ea..60397e67b6 100644 --- a/webrtc/modules/video_coding/codecs/i420/main/source/i420.cc +++ b/webrtc/modules/video_coding/codecs/i420/main/source/i420.cc @@ -171,10 +171,18 @@ I420Decoder::Decode(const EncodedImage& inputImage, if (inputImage._length <= 0) { return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; } + if (inputImage._completeFrame == false) { + return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; + } if (!_inited) { return WEBRTC_VIDEO_CODEC_UNINITIALIZED; } + // Verify that the available length is sufficient: + int req_length = CalcBufferSize(kI420, _width, _height); + if (req_length > static_cast(inputImage._length)) { + return WEBRTC_VIDEO_CODEC_ERROR; + } // Set decoded image parameters. int half_width = (_width + 1) / 2; int half_height = (_height + 1) / 2;