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

IOS/ES: Fix crash when deleting tickets #11592

Merged
merged 1 commit into from
Feb 21, 2023

Conversation

Pokechu22
Copy link
Contributor

This broke formatting the system memory; see https://bugs.dolphin-emu.org/issues/13176. After calling ticket.DeleteTicket(), ticket.m_bytes was 0-length, but calling ticket.IsV1Ticket() still attempted to read from m_bytes.

This was introduced in 2fd9852 (#11240), although it didn't actually cause a crash until 929fba0 (#11383).

I'm not 100% sure if deleting a V1 ticket requires special logic (probably not), or if the process of deleting a V1 ticket could convert it into a V0 ticket somehow (I added an assertion for this). @noahpistilli may know more.

This broke formatting the system memory; see https://bugs.dolphin-emu.org/issues/13176. After calling ticket.DeleteTicket(), ticket.m_bytes was 0-length, but calling ticket.IsV1Ticket() still attempted to read from m_bytes.

This was introduced in 2fd9852, although it didn't actually cause a crash until 929fba0.
@leoetlino
Copy link
Member

I'm not 100% sure if deleting a V1 ticket requires special logic (probably not)

Kind of. v1 tickets are variable-size, but we currently assume that there can only be one v1 ticket in a ticket file, so the existing logic in DeleteTicket and the other TicketReader functions work just fine.

Technically that is an assumption we should not be making because ES does seem to have the ability to store multiple v1 tickets in a single v1 ticket file, but I'm not sure if that feature is used by any official title.

or if the process of deleting a V1 ticket could convert it into a V0 ticket somehow (I added an assertion for this).

No, that's impossible given the assumption I mentioned earlier and also because v1 tickets are stored in a separate ticket file (the one with a .tv1 extension) that exclusively stores v1 tickets. So the assertion seems correct to me.

@leoetlino leoetlino merged commit 3c4a213 into dolphin-emu:master Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants