mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-23 17:01:49 +01:00
Fix UB with guest-less Texture/Buffers in MarkGpuDirty
As there was no check for the lack of a `GuestTexture`/`GuestBuffer`, it would lead to UB when a texture/buffer that had no guest such as the `zeroTexture` from `GraphicsContext` would be marked as dirty they would cause a call to `NCE::RetrapRegions` with a `nullptr` handle that would be dereferenced and cause a segmentation fault.
This commit is contained in:
parent
372ab8befa
commit
8ccef733ff
@ -45,7 +45,7 @@ namespace skyline::gpu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Buffer::MarkGpuDirty() {
|
void Buffer::MarkGpuDirty() {
|
||||||
if (dirtyState == DirtyState::GpuDirty || externallySynchronized) {
|
if (dirtyState == DirtyState::GpuDirty || externallySynchronized || !guest) {
|
||||||
externallySynchronized = false; // We want to handle synchronize internally after the GPU work is done
|
externallySynchronized = false; // We want to handle synchronize internally after the GPU work is done
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -348,7 +348,7 @@ namespace skyline::gpu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Texture::MarkGpuDirty() {
|
void Texture::MarkGpuDirty() {
|
||||||
if (dirtyState == DirtyState::GpuDirty)
|
if (dirtyState == DirtyState::GpuDirty || !guest)
|
||||||
return;
|
return;
|
||||||
gpu.state.nce->RetrapRegions(*trapHandle, false);
|
gpu.state.nce->RetrapRegions(*trapHandle, false);
|
||||||
dirtyState = DirtyState::GpuDirty;
|
dirtyState = DirtyState::GpuDirty;
|
||||||
|
Loading…
Reference in New Issue
Block a user