From 57c127898d1a1d45cfa6e63e1c3fb63ef1cb0177 Mon Sep 17 00:00:00 2001 From: khoidauminh Date: Fri, 15 Nov 2024 10:36:45 +0700 Subject: [PATCH] Fix corruption crash when zooming on a large sample --- src/gui/SampleWaveform.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/SampleWaveform.cpp b/src/gui/SampleWaveform.cpp index 165ede4ee89..845f08357d3 100644 --- a/src/gui/SampleWaveform.cpp +++ b/src/gui/SampleWaveform.cpp @@ -49,7 +49,7 @@ void SampleWaveform::visualize(Parameters parameters, QPainter& painter, const Q auto max = std::vector(numPixels, -1); auto squared = std::vector(numPixels, 0); - const size_t maxFrames = static_cast(numPixels * framesPerPixel); + const size_t maxFrames = numPixels * static_cast(framesPerPixel); auto pixelIndex = std::size_t{0}; @@ -66,7 +66,7 @@ void SampleWaveform::visualize(Parameters parameters, QPainter& painter, const Q squared[pixelIndex] += value * value; } - + if (pixelIndex < numPixels) { numPixels = pixelIndex;