Fixed minor memory leak, out-of-bounds memory access, uninit memory reads and compilation warnings

This commit is contained in:
Sour 2018-06-14 23:29:15 -04:00
parent 7896e9d5ac
commit 6c9d44a9c1
4 changed files with 8 additions and 7 deletions

View file

@ -24,7 +24,7 @@ BisqwitNtscFilter::BisqwitNtscFilter(int resDivider)
int q = signalLumaHigh[r / 0x10];
if((r & 0x0F) == 13) {
q = m;
} else if((r & 0x0F) == 0) {
} else if((r & 0x0F) == 0) {
m = q;
}
_signalLow[i] = m;
@ -48,7 +48,7 @@ BisqwitNtscFilter::BisqwitNtscFilter(int resDivider)
outputBuffer += GetOverscan().GetScreenWidth() * 64 / _resDivider / _resDivider * (120 - GetOverscan().Top);
}
DecodeFrame(120, 239 - GetOverscan().Bottom, _ppuOutputBuffer, outputBuffer, (IsOddFrame() ? 8 : 0) + 327360);
DecodeFrame(120, 239 - GetOverscan().Bottom, _ppuOutputBuffer, outputBuffer, (IsOddFrame() ? 8 : 0) + 327360);
_workDone = true;
}
@ -165,7 +165,7 @@ void BisqwitNtscFilter::GenerateNtscSignal(int8_t *ntscSignal, int &phase, int r
int8_t high = _signalHigh[color & 0x3F];
int8_t emphasis = color >> 6;
uint16_t phaseBitmask = _bitmaskLut[(phase - (color & 0x0F)) % 12];
uint16_t phaseBitmask = _bitmaskLut[std::abs(phase - (color & 0x0F)) % 12];
uint8_t voltage;
for(int j = 0; j < 8; j++) {

View file

@ -63,7 +63,6 @@ void NtscFilter::OnBeforeApplyFilter()
_ntscSetup.artifacts != ntscSettings.Artifacts || _ntscSetup.bleed != ntscSettings.Bleed || _ntscSetup.fringing != ntscSettings.Fringing || _ntscSetup.gamma != ntscSettings.Gamma ||
(_ntscSetup.merge_fields == 1) != ntscSettings.MergeFields || _ntscSetup.resolution != ntscSettings.Resolution || _ntscSetup.sharpness != ntscSettings.Sharpness) {
_ntscData = new nes_ntsc_t();
_ntscSetup.hue = pictureSettings.Hue;
_ntscSetup.saturation = pictureSettings.Saturation;
_ntscSetup.brightness = pictureSettings.Brightness;

View file

@ -109,7 +109,6 @@ namespace Mesen.GUI.Debugger.Controls
private void SortData()
{
int sortOrder = _sortAscending ? 1 : -1;
_debugEvents.Sort((DebugEventInfo a, DebugEventInfo b) => {
int result = 0;
switch(_sortColumn) {

View file

@ -680,7 +680,7 @@ tinfl_status tinfl_decompress(tinfl_decompressor *r, const mz_uint8 *pIn_buf_nex
{
TINFL_GET_BYTE(1, r->m_zhdr0); TINFL_GET_BYTE(2, r->m_zhdr1);
counter = (((r->m_zhdr0 * 256 + r->m_zhdr1) % 31 != 0) || (r->m_zhdr1 & 32) || ((r->m_zhdr0 & 15) != 8));
if (!(decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF)) counter |= (((1U << (8U + (r->m_zhdr0 >> 4))) > 32768U) || ((out_buf_size_mask + 1) < (size_t)(1U << (8U + (r->m_zhdr0 >> 4)))));
if (!(decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF)) counter |= (((1U << (8U + (r->m_zhdr0 >> 4))) > 32768U) || ((out_buf_size_mask + 1) < (unsigned int)(1U << (8U + (r->m_zhdr0 >> 4)))));
if (counter) { TINFL_CR_RETURN_FOREVER(36, TINFL_STATUS_FAILED); }
}
@ -1929,7 +1929,10 @@ tdefl_status tdefl_init(tdefl_compressor *d, tdefl_put_buf_func_ptr pPut_buf_fun
d->m_pPut_buf_func = pPut_buf_func; d->m_pPut_buf_user = pPut_buf_user;
d->m_flags = (mz_uint)(flags); d->m_max_probes[0] = 1 + ((flags & 0xFFF) + 2) / 3; d->m_greedy_parsing = (flags & TDEFL_GREEDY_PARSING_FLAG) != 0;
d->m_max_probes[1] = 1 + (((flags & 0xFFF) >> 2) + 2) / 3;
if (!(flags & TDEFL_NONDETERMINISTIC_PARSING_FLAG)) MZ_CLEAR_OBJ(d->m_hash);
if (!(flags & TDEFL_NONDETERMINISTIC_PARSING_FLAG)) {
MZ_CLEAR_OBJ(d->m_hash);
MZ_CLEAR_OBJ(d->m_dict);
}
d->m_lookahead_pos = d->m_lookahead_size = d->m_dict_size = d->m_total_lz_bytes = d->m_lz_code_buf_dict_pos = d->m_bits_in = 0;
d->m_output_flush_ofs = d->m_output_flush_remaining = d->m_finished = d->m_block_index = d->m_bit_buffer = d->m_wants_to_finish = 0;
d->m_pLZ_code_buf = d->m_lz_code_buf + 1; d->m_pLZ_flags = d->m_lz_code_buf; d->m_num_flags_left = 8;