From c3c657183513022d5b76861d05c7a10d2b1e6028 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 10 Jul 2019 12:52:36 +0200 Subject: [PATCH] Add checks for incorrect sticker cache bytes. --- Telegram/SourceFiles/lottie/lottie_cache.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Telegram/SourceFiles/lottie/lottie_cache.cpp b/Telegram/SourceFiles/lottie/lottie_cache.cpp index 4f742773da..13d2723818 100644 --- a/Telegram/SourceFiles/lottie/lottie_cache.cpp +++ b/Telegram/SourceFiles/lottie/lottie_cache.cpp @@ -594,6 +594,9 @@ void Cache::prepareBuffers() { } Cache::ReadResult Cache::readCompressedFrame() { + if (_data.size() < _offset) { + return { false }; + } auto length = qint32(0); const auto part = bytes::make_span(_data).subspan(_offset); if (part.size() < sizeof(length)) {