From e522a636cad55116c2783d55a53988c5b0835518 Mon Sep 17 00:00:00 2001 From: "Xu, Zhengguo" Date: Thu, 22 Aug 2024 11:50:43 +0800 Subject: [PATCH] [Decode] Fix mpeg2 decoding issue to avoid piece of bitstream reading overflow Fixes: #342 Signed-off-by: Xu, Zhengguo --- _studio/shared/umc/codec/mpeg2_dec/src/umc_mpeg2_splitter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_studio/shared/umc/codec/mpeg2_dec/src/umc_mpeg2_splitter.cpp b/_studio/shared/umc/codec/mpeg2_dec/src/umc_mpeg2_splitter.cpp index 68401a85aa..8b4b7caabc 100644 --- a/_studio/shared/umc/codec/mpeg2_dec/src/umc_mpeg2_splitter.cpp +++ b/_studio/shared/umc/codec/mpeg2_dec/src/umc_mpeg2_splitter.cpp @@ -84,7 +84,7 @@ namespace UMC_MPEG2_DECODER else // start code wasn't found { // Load the data excepte last 1 or 2 bytes if they have zero values (Considering [... 0x0 0x0] [0x1 ...]) to the cache - uint32_t numZerosAtEnd = (0 == end[-1]) ? 1 + (0 == end[-2]) : 0; + uint32_t numZerosAtEnd = (0 == end[-1]) ? 1 + (in->GetDataSize() > 1 ? (0 == end[-2]) : 0) : 0; readSize = (uint32_t)(end - begin - numZerosAtEnd); m_cache.insert(m_cache.end(), (uint8_t *)begin, (uint8_t *)(end - numZerosAtEnd)); }