Fix an overflow crash in DiscImageDevice::Verify
This commit is contained in:
parent
9473f20c7f
commit
e8719dd949
|
@ -84,6 +84,10 @@ DiscImageDevice::Error DiscImageDevice::Verify(ParseState* state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DiscImageDevice::VerifyMagic(ParseState* state, size_t offset) {
|
bool DiscImageDevice::VerifyMagic(ParseState* state, size_t offset) {
|
||||||
|
if (offset >= state->size) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Simple check to see if the given offset contains the magic value.
|
// Simple check to see if the given offset contains the magic value.
|
||||||
return std::memcmp(state->ptr + offset, "MICROSOFT*XBOX*MEDIA", 20) == 0;
|
return std::memcmp(state->ptr + offset, "MICROSOFT*XBOX*MEDIA", 20) == 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue