Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent out of memory errors when the game passes in an improper length value #5024

Merged
merged 1 commit into from Jan 21, 2020

Conversation

jroweboy
Copy link
Contributor

@jroweboy jroweboy commented Dec 15, 2019

This is a HACK, but we also shouldn't freeze the users computer by allocating more RAM than they could possibly have, so I am opening this with full intention to merge anyway. I've researched this issue fairly extensively so far without any proper fix for it yet, so I will open an issue about fixing this hack.

Details:

In Luigi's Mansion Dark Moon in HLE audio, the game mysteriously passes in an extremely large value for length, which without any checks, causing HLE audio to allocate an extremely large buffer.

This value seemingly is caused by some other missing or incomplete HLE audio feature. The game seemingly reads a value from the DSP and subtracts to get a length, without checking for underflow first. This appears to be caused by an incorrect HLE audio emulation something-or-other, as its fixed entirely by only changing to LLE (if it was elsewhere it would likely happen in LLE as well). When reaching this point in LLE, the game writes an appropriate value for length when playing that audio effect. As such, further investigation is required, but in the meantime, completely eating up our users RAM is unacceptable.

I've only observed it on the source embedded buffer, but i don't want to risk it happening on the source buffers since the consequences are pretty annoying.


This change is Reviewable

…th value

HACK

In Luigi's Mansion Dark Moon in HLE audio, the game mysteriously passes
in an extremely large value for length, which without any checks, causes
HLE audio to allocate an extremely large buffer.

This value seemingly is caused by some other HLE audio feature is missing,
and Luigi's Mansion subtracts two values to get a length, without
checking for overflow first. This appears to be caused by an incorrect
HLE audio emulation, as its fixed entirely by only changing to LLE. As
such, further investigation is required, but in the meantime, completely
eating up our users RAM is unacceptable.
@wwylele
Copy link
Member

wwylele commented Dec 15, 2019

#4281 might get affected by this nvm

@jroweboy
Copy link
Contributor Author

jroweboy commented Jan 21, 2020

Since hard freezing peoples computers is a #BadThing I'm going to merge this until we get a proper resolution for this issue.

@jroweboy jroweboy merged commit 5fd1ff0 into citra-emu:master Jan 21, 2020
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants