mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-23 09:51:09 +00:00
Merge pull request #242 from practicalswift/segfault-on-stop
Fix segfault on emu_stop()
This commit is contained in:
commit
f70dc1becd
13
tests/regress/segfault_on_stop.py
Executable file
13
tests/regress/segfault_on_stop.py
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import regress
|
||||||
|
import unicorn
|
||||||
|
|
||||||
|
|
||||||
|
class SegfaultOnStop(regress.RegressTest):
|
||||||
|
def test(self):
|
||||||
|
unicorn.Uc(unicorn.UC_ARCH_X86, unicorn.UC_MODE_64).emu_stop()
|
||||||
|
self.assertTrue(True, "If not reached, then we have a crashing bug.")
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
regress.main()
|
2
uc.c
2
uc.c
|
@ -525,8 +525,10 @@ uc_err uc_emu_stop(uc_engine *uc)
|
||||||
return UC_ERR_OK;
|
return UC_ERR_OK;
|
||||||
|
|
||||||
uc->stop_request = true;
|
uc->stop_request = true;
|
||||||
|
if (uc->current_cpu) {
|
||||||
// exit the current TB
|
// exit the current TB
|
||||||
cpu_exit(uc->current_cpu);
|
cpu_exit(uc->current_cpu);
|
||||||
|
}
|
||||||
|
|
||||||
return UC_ERR_OK;
|
return UC_ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue