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;