Mutex around PBP file access.

There's some thread safety issue in there, this makes it so we can read
thumbnails without crashing sometimes - fixes #7330.
This commit is contained in:
Unknown W. Brackets committed 2015-12-20 09:35:50 -08:00
1 parent 39d1dd3a01
commit 7807598690
2 files changed
+7

No files matched your search

+5
View File
@@ -344,9 +344,12 @@ bool CISOFileBlockDevice::ReadBlocks(u32 minBlock, int count, u8 *outPtr) {
}
recursive_mutex NPDRMDemoBlockDevice::mutex_;
NPDRMDemoBlockDevice::NPDRMDemoBlockDevice(FileLoader *fileLoader)
: fileLoader_(fileLoader)
{
lock_guard guard(mutex_);
MAC_KEY mkey;
CIPHER_KEY ckey;
u8 np_header[256];
@@ -412,6 +415,7 @@ NPDRMDemoBlockDevice::NPDRMDemoBlockDevice(FileLoader *fileLoader)
NPDRMDemoBlockDevice::~NPDRMDemoBlockDevice()
{
lock_guard guard(mutex_);
delete [] table;
delete [] tempBuf;
delete [] blockBuf;
@@ -421,6 +425,7 @@ int lzrc_decompress(void *out, int out_len, void *in, int in_len);
bool NPDRMDemoBlockDevice::ReadBlock(int blockNumber, u8 *outPtr)
{
lock_guard guard(mutex_);
CIPHER_KEY ckey;
int block, lba, lzsize;
size_t readSize;