[PR #628] [MERGED] crypto: Fix deallocation of key data while in use. #1676

Closed
opened 2026-02-27 21:13:31 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/628
Author: @squidbus
Created: 8/28/2024
Status: Merged
Merged: 8/28/2024
Merged by: @georgemoralis

Base: mainHead: pkg-fix


📝 Commits (1)

  • 4a6ce1e crypto: Fix deallocation of key data while in use.

📊 Changes

3 files changed (+299 additions, -422 deletions)

View changed files

📝 src/core/crypto/crypto.cpp (+32 -35)
📝 src/core/crypto/crypto.h (+0 -4)
📝 src/core/crypto/keys.h (+267 -383)

📄 Description

A recent PR added destructors to the keyset classes. However, these classes get copied as part of PKG, and when the original goes out of scope the keyset arrays are deleted, leaving invalid pointers in the copy.

This resolves the issue by simply making the keyset data into static constants, rather than instance members allocated in the constructor.

Fixes https://github.com/shadps4-emu/shadPS4/issues/627


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/shadps4-emu/shadPS4/pull/628 **Author:** [@squidbus](https://github.com/squidbus) **Created:** 8/28/2024 **Status:** ✅ Merged **Merged:** 8/28/2024 **Merged by:** [@georgemoralis](https://github.com/georgemoralis) **Base:** `main` ← **Head:** `pkg-fix` --- ### 📝 Commits (1) - [`4a6ce1e`](https://github.com/shadps4-emu/shadPS4/commit/4a6ce1e0d6e3cc7497a600dd9a62d68cbbe3422f) crypto: Fix deallocation of key data while in use. ### 📊 Changes **3 files changed** (+299 additions, -422 deletions) <details> <summary>View changed files</summary> 📝 `src/core/crypto/crypto.cpp` (+32 -35) 📝 `src/core/crypto/crypto.h` (+0 -4) 📝 `src/core/crypto/keys.h` (+267 -383) </details> ### 📄 Description A recent PR added destructors to the keyset classes. However, these classes get copied as part of `PKG`, and when the original goes out of scope the keyset arrays are deleted, leaving invalid pointers in the copy. This resolves the issue by simply making the keyset data into static constants, rather than instance members allocated in the constructor. Fixes https://github.com/shadps4-emu/shadPS4/issues/627 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 21:13:31 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shadPS4#1676
No description provided.