LMMS / LMMS/lmms

Clean up computation of "from" and "to" values in AudioFileProcessorWaveView

Open
#7,074 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
10.4k
Forks
1.3k
Avg merge
2d 13h
Merged PRs (30d)
7

Description

Pull request #7071 has fixed a crash that was reported in #7068 by adding safety checks via two new setter methods in plugins/AudioFileProcessor/AudioFileProcessorWaveView.h.

While the crash is gone there is still code that tries to set the "from" and "to" values to invalid values. One such method is AudioFileProcessorWaveView::slide. To fix this adjust the two new setters as follows:

void AudioFileProcessorWaveView::setTo(f_cnt_t to)
{
	assert (to <= m_sample->sampleSize());
	m_to = std::min(to, static_cast<lmms::f_cnt_t>(m_sample->sampleSize()));
}

void AudioFileProcessorWaveView::setFrom(f_cnt_t from)
{
	assert (from >= 0);
	m_from = std::max(from, 0);
}

Then follow these steps:

  1. Add an AFP and open it's view.
  2. Drag a sample onto the sample view of the AFP, e.g. drums/clap01.ogg from the factory samples.
  3. Click with the left mouse button on the sample display and drag to the right until the crash occurs.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in plugins/AudioFileProcessor/AudioFileProcessorWaveView.h and inspect the two setter methods, then trace how AudioFileProcessorWaveView::slide supplies its values. Reproduce the issue by opening an Audio File Processor, loading drums/clap01.ogg, and dragging across the sample display; done means invalid "from" and "to" values no longer lead to the reported crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
audio-video-rtc, desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.