[XMA] Check for invalid packet number in ValidFrameOffset

This commit is contained in:
Dr. Chat 2017-12-26 20:57:28 -06:00
parent 8784daf6bc
commit bfc8ecbeaa
1 changed files with 5 additions and 0 deletions

View File

@ -225,6 +225,11 @@ bool XmaContext::ValidFrameOffset(uint8_t* block, size_t size_bytes,
size_t frame_offset_bits) { size_t frame_offset_bits) {
uint32_t packet_num = uint32_t packet_num =
GetFramePacketNumber(block, size_bytes, frame_offset_bits); GetFramePacketNumber(block, size_bytes, frame_offset_bits);
if (packet_num == -1) {
// Invalid packet number
return false;
}
uint8_t* packet = block + (packet_num * kBytesPerPacket); uint8_t* packet = block + (packet_num * kBytesPerPacket);
size_t relative_offset_bits = frame_offset_bits % (kBytesPerPacket * 8); size_t relative_offset_bits = frame_offset_bits % (kBytesPerPacket * 8);