mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-27 06:55:54 -04:00
Merge branch 'fix_undefined_behavior_storetest' into 'master'
Fix #4835 - undefined behavior - uninitialized mCtx Closes #4835 See merge request OpenMW/openmw!64
This commit is contained in:
commit
3a1a24151a
@ -27,6 +27,7 @@ ESMReader::ESMReader()
|
||||
, mEncoder(nullptr)
|
||||
, mFileSize(0)
|
||||
{
|
||||
clearCtx();
|
||||
}
|
||||
|
||||
int ESMReader::getFormat() const
|
||||
@ -50,16 +51,21 @@ void ESMReader::restoreContext(const ESM_Context &rc)
|
||||
void ESMReader::close()
|
||||
{
|
||||
mEsm.reset();
|
||||
mCtx.filename.clear();
|
||||
mCtx.leftFile = 0;
|
||||
mCtx.leftRec = 0;
|
||||
mCtx.leftSub = 0;
|
||||
mCtx.subCached = false;
|
||||
mCtx.recName.clear();
|
||||
mCtx.subName.clear();
|
||||
clearCtx();
|
||||
mHeader.blank();
|
||||
}
|
||||
|
||||
void ESMReader::clearCtx()
|
||||
{
|
||||
mCtx.filename.clear();
|
||||
mCtx.leftFile = 0;
|
||||
mCtx.leftRec = 0;
|
||||
mCtx.leftSub = 0;
|
||||
mCtx.subCached = false;
|
||||
mCtx.recName.clear();
|
||||
mCtx.subName.clear();
|
||||
}
|
||||
|
||||
void ESMReader::openRaw(Files::IStreamPtr _esm, const std::string& name)
|
||||
{
|
||||
close();
|
||||
|
@ -269,6 +269,8 @@ public:
|
||||
size_t getFileSize() const { return mFileSize; }
|
||||
|
||||
private:
|
||||
void clearCtx();
|
||||
|
||||
Files::IStreamPtr mEsm;
|
||||
|
||||
ESM_Context mCtx;
|
||||
|
Loading…
x
Reference in New Issue
Block a user