Jump to content

Memory Leak Fix about Pack type Hybrid - SDB and Panama


Ken

Recommended Posts

  • Bronze

Hi everyone, I would like to share a memory leak fix about pack type Hybrid, Hybrid with SDB and panama. I saw it while analyzing Webzen's new pack type.

EterPack.cpp

Search this:

		if( !m_pCSHybridCryptPolicy->DecryptMemory(std::string(filename), static_cast<const BYTE*>(*data), index->data_size, *zObj) )
		{
			return false;
		}

Replace with this

		if( !m_pCSHybridCryptPolicy->DecryptMemory(std::string(filename), static_cast<const BYTE*>(*data), index->data_size, *zObj) )
		{
			delete zObj;
			return false;
		}

Search this:

			if( !m_pCSHybridCryptPolicy->GetSupplementaryDataBlock(std::string(filename), pSDBData, iSDBSize) )
			{
				return false;
			}

Replace with this

			if( !m_pCSHybridCryptPolicy->GetSupplementaryDataBlock(std::string(filename), pSDBData, iSDBSize) )
			{
				delete zObj;
				return false;
			}

 

Search this:

	else if (COMPRESSED_TYPE_PANAMA == index->compressed_type)
	{
		CLZObject * zObj = new CLZObject;
		__Decrypt_Panama(filename, static_cast<const BYTE*>(*data), index->data_size, *zObj);
		out_file.BindLZObjectWithBufferedSize(zObj);
		*data = zObj->GetBuffer();
	}

Replace with this:

	else if (COMPRESSED_TYPE_PANAMA == index->compressed_type)
	{
		CLZObject * zObj = new CLZObject;
		if (!__Decrypt_Panama(filename, static_cast<const BYTE*>(*data), index->data_size, *zObj))
		{
			delete zObj;
			return false;
		}

		out_file.BindLZObjectWithBufferedSize(zObj);
		*data = zObj->GetBuffer();
	}

Best Regards

Ken

  • Metin2 Dev 2
  • Confused 2
  • Love 27

Do not be sorry, be better.

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 years later...

Instead: if( !m_pCSHybridCryptPolicy->DecryptMemory(std::string(filename), static_cast<const BYTE*>(*data), index->data_size, *zObj) )

I have it 2x:  if( !m_pCSHybridCryptPolicy->DecryptMemory(string(filename), static_cast<const BYTE*>(*data), index->data_size, *zObj) )

Instead: if( !m_pCSHybridCryptPolicy->GetSupplementaryDataBlock(std::string(filename), pSDBData, iSDBSize) )

I have it 2x: if( !m_pCSHybridCryptPolicy->GetSupplementaryDataBlock(string(filename), pSDBData, iSDBSize) )

and 1x: if( !m_pCSHybridCryptPolicy->GetSupplementaryDataBlock(string(index->filename), pSDBData, iSDBSize) )

This: else if (COMPRESSED_TYPE_PANAMA == index->compressed_type) { CLZObject * zObj = new CLZObject; __Decrypt_Panama(filename, static_cast<const BYTE*>(*data), index->data_size, *zObj); out_file.BindLZObjectWithBufferedSize(zObj); *data = zObj->GetBuffer(); }

I have it 2x.

So how do you add it correctly? Under every found?

  • Metin2 Dev 1
Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.