Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zero-width volume MML macro crashes the program #222

Closed
Gumball2415 opened this issue Jun 20, 2023 · 1 comment · Fixed by #214
Closed

Zero-width volume MML macro crashes the program #222

Gumball2415 opened this issue Jun 20, 2023 · 1 comment · Fixed by #214

Comments

@Gumball2415
Copy link
Collaborator

Steps to reproduce: enter 15:0 in the volume envelope of any instrument

@Gumball2415
Copy link
Collaborator Author

Gumball2415 commented Nov 29, 2023

integer division by zero error on this line, when m_iValueDiv == 0

char CSeqConversionDefault::GetValue()
{
	// do not use float division
	int Val = m_iCurrentValue;
	if (Val > m_iMaxValue) Val = m_iMaxValue;
	if (Val < m_iMinValue) Val = m_iMinValue;
	if (++m_iRepeatCounter >= m_iRepeat) {
		m_iValueMod += m_iValueInc;
		m_iCurrentValue += m_iValueMod / m_iValueDiv; // division by zero!
		m_iValueMod %= m_iValueDiv;
		m_iRepeatCounter = 0;
		if (++m_iCounter >= m_iValueDiv)
			m_bReady = false;
	}
	return Val;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant