[APU/XMA] Prevent crash with invalid packet number
This commit is contained in:
parent
8f1f849a06
commit
57ce647bb3
|
@ -442,12 +442,17 @@ void XmaContext::Decode(XMA_CONTEXT_DATA* data) {
|
||||||
} else {
|
} else {
|
||||||
if (data->input_buffer_read_offset % kBitsPerPacket == 0) {
|
if (data->input_buffer_read_offset % kBitsPerPacket == 0) {
|
||||||
// Invalid offset. Go ahead and set it.
|
// Invalid offset. Go ahead and set it.
|
||||||
|
int packet_number =
|
||||||
|
GetFramePacketNumber(current_input_buffer, current_input_size,
|
||||||
|
data->input_buffer_read_offset);
|
||||||
|
|
||||||
|
if (packet_number == -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto offset =
|
auto offset =
|
||||||
xma::GetPacketFrameOffset(
|
xma::GetPacketFrameOffset(current_input_buffer +
|
||||||
current_input_buffer +
|
kBytesPerPacket * packet_number) +
|
||||||
kBytesPerPacket * GetFramePacketNumber(
|
|
||||||
current_input_buffer, current_input_size,
|
|
||||||
data->input_buffer_read_offset)) +
|
|
||||||
data->input_buffer_read_offset;
|
data->input_buffer_read_offset;
|
||||||
if (offset == -1) {
|
if (offset == -1) {
|
||||||
// No more frames.
|
// No more frames.
|
||||||
|
|
Loading…
Reference in New Issue