Skip to content

Commit

Permalink
[Decode] Fix mpeg2 decoding issue to avoid piece of bitstream reading…
Browse files Browse the repository at this point in the history
… overflow

Fixes: #342

Signed-off-by: Xu, Zhengguo <[email protected]>
  • Loading branch information
Jexu authored and gfxVPLsdm committed Oct 9, 2024
1 parent 41d6585 commit e522a63
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit e522a63

Please sign in to comment.