From f875fd22c078ef0f12196335c13d5ee7a88d58ec Mon Sep 17 00:00:00 2001 From: "mikhal@webrtc.org" Date: Fri, 9 Nov 2012 18:48:30 +0000 Subject: [PATCH] i420:verify image length BUG= Review URL: https://webrtc-codereview.appspot.com/930016 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3071 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 f5831823e..60397e67b 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;