diff options
| author | 2018-10-18 13:01:26 -0400 | |
|---|---|---|
| committer | 2018-10-18 13:01:29 -0400 | |
| commit | 4b5ae8dbaa267d0f269ded8e621b43065fb5ae20 (patch) | |
| tree | 95163871607854a07df6c2647a4d6babb42af873 /src | |
| parent | common: Add function for checking word alignment to alignment.h (diff) | |
| download | yuzu-4b5ae8dbaa267d0f269ded8e621b43065fb5ae20.tar.gz yuzu-4b5ae8dbaa267d0f269ded8e621b43065fb5ae20.tar.xz yuzu-4b5ae8dbaa267d0f269ded8e621b43065fb5ae20.zip | |
svc: Check for word alignment of addresses within svcArbitrateLock/svcArbitrateUnlock
The kernel itself checks whether or not the provided addresses are word
aligned before continuing, so we should be doing the same.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index b0bdd822e..d3c9d50b5 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -350,6 +350,10 @@ static ResultCode ArbitrateLock(Handle holding_thread_handle, VAddr mutex_addr, | |||
| 350 | return ERR_INVALID_ADDRESS_STATE; | 350 | return ERR_INVALID_ADDRESS_STATE; |
| 351 | } | 351 | } |
| 352 | 352 | ||
| 353 | if (!Common::IsWordAligned(mutex_addr)) { | ||
| 354 | return ERR_INVALID_ADDRESS; | ||
| 355 | } | ||
| 356 | |||
| 353 | auto& handle_table = Core::System::GetInstance().Kernel().HandleTable(); | 357 | auto& handle_table = Core::System::GetInstance().Kernel().HandleTable(); |
| 354 | return Mutex::TryAcquire(handle_table, mutex_addr, holding_thread_handle, | 358 | return Mutex::TryAcquire(handle_table, mutex_addr, holding_thread_handle, |
| 355 | requesting_thread_handle); | 359 | requesting_thread_handle); |
| @@ -363,6 +367,10 @@ static ResultCode ArbitrateUnlock(VAddr mutex_addr) { | |||
| 363 | return ERR_INVALID_ADDRESS_STATE; | 367 | return ERR_INVALID_ADDRESS_STATE; |
| 364 | } | 368 | } |
| 365 | 369 | ||
| 370 | if (!Common::IsWordAligned(mutex_addr)) { | ||
| 371 | return ERR_INVALID_ADDRESS; | ||
| 372 | } | ||
| 373 | |||
| 366 | return Mutex::Release(mutex_addr); | 374 | return Mutex::Release(mutex_addr); |
| 367 | } | 375 | } |
| 368 | 376 | ||