In Rar1Decoder.h, Rar2Decoder.h, Rar3Decoder.h, and Rar5Decoder.h: add a member variable "bool _solidAllowed;" right after the member "bool _isSolid;" In Rar1Decoder.cpp: The constructor now looks as follows: CDecoder::CDecoder(): _isSolid(false), _solidAllowed(false) { } Moreover, the beginning of the function CDecoder::CodeReal now is as follows: if (_isSolid && !_solidAllowed) return S_FALSE; _solidAllowed = false; if (!m_OutWindowStream.Create(kHistorySize)) return E_OUTOFMEMORY; ... Finally, before returning, we set the flag to true: ... RINOK(HuffDecode()); } _solidAllowed = true; return m_OutWindowStream.Flush(); In Rar2Decoder.cpp: The constructor now looks as follows: CDecoder::CDecoder(): _isSolid(false), _solidAllowed(false), m_TablesOK(false) {} Then, CDecoder::CodeReal begins as follows: if (!inSize || !outSize) return E_INVALIDARG; if (_isSolid && !_solidAllowed) return S_FALSE; _solidAllowed = false; if (!m_OutWindowStream.Create(kHistorySize)) return E_OUTOFMEMORY; ... Moreover, before the first successful return, we set the flag to true: ... if (unPackSize == 0) { if (m_InBitStream.GetProcessedSize() + 2 <= m_PackSize) // test it: probably incorrect; if (!ReadTables()) return S_FALSE; _solidAllowed = true; return S_OK; } ... Finally, we set the flag to true before the last return: ... if (!ReadLastTables()) return S_FALSE; _solidAllowed = true; return m_OutWindowStream.Flush(); In Rar3Decoder.cpp: The constructor now looks as follows: CDecoder::CDecoder(): _window(0), _winPos(0), _wrPtr(0), _lzSize(0), _writtenFileSize(0), _vmData(0), _vmCode(0), _isSolid(false), _solidAllowed(false) { Ppmd7_Construct(&_ppmd); } Then, the method CDecoder::Code begins as follows: try { if (!inSize) return E_INVALIDARG; if (_isSolid && !_solidAllowed) return S_FALSE; _solidAllowed = false; if (!_vmData) ... Next, we set the flag to true before the first successful return: ... if (!_isSolid || !TablesRead) { bool keepDecompressing; RINOK(ReadTables(keepDecompressing)); if (!keepDecompressing) { _solidAllowed = true; return S_OK; } } ... Finally, we set the flag to true before calling WriteBuf(): ... if (!keepDecompressing) break; } _solidAllowed = true; RINOK(WriteBuf()); UInt64 packSize = m_InBitStream.BitDecoder.GetProcessedSize(); ... In Rar5Decoder.cpp: The constructor now looks as follows: CDecoder::CDecoder(): _window(NULL), _winPos(0), _winSizeAllocated(0), _lzSize(0), _lzEnd(0), _writtenFileSize(0), _dictSizeLog(0), _isSolid(false), _solidAllowed(false), _wasInit(false), _inputBuf(NULL) { } Then, the method CDecoder::Code now begins as follows: try { if (_isSolid && !_solidAllowed) return S_FALSE; _solidAllowed = false; if (_dictSizeLog >= sizeof(size_t) * 8) return E_NOTIMPL; ... Finally, the method CDecoder::CodeReal now ends as follows: ... if (res == S_OK) { _solidAllowed = true; res = res2; } if (res == S_OK && _unpackSize_Defined && _writtenFileSize != _unpackSize) return S_FALSE; return res;