Mpeg: Make sure not to demux outside the buffer.

This commit is contained in:
Unknown W. Brackets 2016-06-04 16:09:38 -07:00
parent 6d14c17f26
commit b191fd2914
2 changed files with 3 additions and 3 deletions

View file

@ -158,7 +158,7 @@ void MpegDemux::demux(int audioChannel)
{
if (audioChannel >= 0)
m_audioChannel = audioChannel;
while (m_index < m_len)
while (m_index < m_readSize)
{
if (m_index + 2048 > m_readSize)
break;
@ -202,7 +202,7 @@ void MpegDemux::demux(int audioChannel)
}
if (m_index < m_readSize) {
int size = m_readSize - m_index;
memcpy(m_buf, m_buf + m_index, size);
memmove(m_buf, m_buf + m_index, size);
m_index = 0;
m_readSize = size;
} else {

View file

@ -53,7 +53,7 @@ private:
return (((s64) (c & 0x0E)) << 29) | ((read16() >> 1) << 15) | (read16() >> 1);
}
bool isEOF() const {
return m_index >= m_len;
return m_index >= m_readSize;
}
void skip(int n) {
if (n > 0) {