Merge pull request #8552 from rzumer/patch-5

Fix cheevos crash when peeking out of range
This commit is contained in:
Twinaphex 2019-04-06 21:34:01 +02:00 committed by GitHub
commit ffad99d886
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -527,11 +527,14 @@ static unsigned cheevos_peek(unsigned address, unsigned num_bytes, void* ud)
address, cheevos_locals.patchdata.console_id);
unsigned value = 0;
switch (num_bytes)
if (data)
{
case 4: value |= data[2] << 16 | data[3] << 24;
case 2: value |= data[1] << 8;
case 1: value |= data[0];
switch (num_bytes)
{
case 4: value |= data[2] << 16 | data[3] << 24;
case 2: value |= data[1] << 8;
case 1: value |= data[0];
}
}
return value;