audiovisualwaveform: detect if the start index exceeds the buffer sample count

Fixes segfault.
This commit is contained in:
itsmattkc
2020-06-11 21:24:50 +10:00
parent a9a13c4b0c
commit ccf5d4cece
3 changed files with 9 additions and 34 deletions
+5
View File
@@ -243,6 +243,11 @@ void AudioVisualWaveform::DrawSample(QPainter *painter, const QVector<SamplePerC
void AudioVisualWaveform::DrawWaveform(QPainter *painter, const QRect& rect, const double& scale, const AudioVisualWaveform &samples, const rational& start_time)
{
int start_sample_index = samples.time_to_samples(start_time);
if (start_sample_index >= samples.nb_samples()) {
return;
}
int next_sample_index = start_sample_index;
int sample_index;
+4
View File
@@ -0,0 +1,4 @@
#ifndef SHADERINFO_H
#define SHADERINFO_H
#endif // SHADERINFO_H
@@ -1,34 +0,0 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef OPENGLSHADERCACHE_H
#define OPENGLSHADERCACHE_H
#include <QString>
#include "openglshader.h"
OLIVE_NAMESPACE_ENTER
using OpenGLShaderCache = QHash<QString, OpenGLShaderPtr>;
OLIVE_NAMESPACE_EXIT
#endif // OPENGLSHADERCACHE_H