Files
ppsspp/Core/HW
Henrik Rydgård 1830945ca7 MpegDemux: fix heap-underflow rewind and add hard bounds to read8/skip
demux()'s "not enough data, rewind and try again next time" logic
unconditionally subtracted 4 (or 6) from m_index, assuming that many
bytes were consumed scanning for a start code. But the inner scan can
also exit via reaching the end of the buffer without finding a start
code at all, having consumed fewer bytes than that - when the buffer
holds under 4 bytes total, m_index goes negative, and the subsequent
memmove(m_buf, m_buf + m_index, size) then reads before the start of
m_buf. Clamp the rewind to 0.

read8()/skip() also had no bounds check against m_len (the actual
buffer allocation) at all - readPesHeader()'s header-length fields are
only cross-checked against the outer PES packet length, not against
how much data is actually available, so a crafted stream claiming a
long header could walk m_index past the buffer. Bound both against
m_len directly, at the lowest-level primitives so every caller is
covered.
2026-08-12 09:43:23 +02:00
..
2026-06-08 23:04:29 +08:00
2026-06-08 23:04:29 +08:00
2026-08-11 10:28:36 +02:00
2025-12-30 20:31:06 +01:00