Skip to content

Crash when rendering spectrum view #8851

@haileys

Description

@haileys

Bug description

Hello!

There is a crash bug I have been regularly encountering involving the spectrogram. Audacity 3.7.3 on Arch Linux.

I've caught the crash in the act and have captured a backtrace with gdb. The cause seems to be an out-of-bounds index in WaveClipSpectrumCache::GetSpectrogram.

Here's the gdb backtrace:

Thread 1 "audacity" received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
44	     return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
(gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007ffff55af813 in __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:89
#2  0x00007ffff5555dc0 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007ffff553d57a in __GI_abort () at abort.c:73
#4  0x00007ffff589a421 in std::__glibcxx_assert_fail
    (file=file@entry=0x555555e0c520 "/usr/include/c++/14.2.1/bits/stl_vector.h", line=line@entry=1130, function=function@entry=0x555555e47360 "std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = float; _Alloc = std::allocator<float>; reference = float&; size_type = long unsigned int]", condition=condition@entry=0x555555dc3fc5 "__n < this->size()") at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/assert_fail.cc:41
#5  0x0000555555c016b0 in std::vector<float, std::allocator<float> >::operator[] (this=<optimized out>, __n=<optimized out>)
    at /usr/include/c++/14.2.1/bits/stl_vector.h:1128
#6  std::vector<float, std::allocator<float> >::operator[] (this=<optimized out>, __n=<optimized out>) at /usr/include/c++/14.2.1/bits/stl_vector.h:1128
#7  WaveClipSpectrumCache::GetSpectrogram
    (this=0x55555a456b10, clip=<optimized out>, spectrogram=@0x7fffffffa788: 0x0, settings=..., where=@0x7fffffffa780: 0x0, numPixels=1293, t0=11.20821955372061, pixelsPerSecond=183.72049102927286) at /usr/src/debug/audacity/audacity-Audacity-3.7.3/src/tracks/playabletrack/wavetrack/ui/SpectrumCache.cpp:536
#8  0x0000555555c09d0d in (anonymous namespace)::DrawClipSpectrum
    (context=..., channel=..., clip=..., rect=..., mpSpectralData=std::shared_ptr<SpectralData> (use count 1, weak count 0) = {...}, selected=false)
    at /usr/src/debug/audacity/audacity-Audacity-3.7.3/src/tracks/playabletrack/wavetrack/ui/SpectrumView.cpp:431
#9  0x0000555555c0b9ec in SpectrumView::DoDraw (this=0x55555a41c480, context=..., channel=..., selectedClip=0x0, rect=...)
    at /usr/include/c++/14.2.1/bits/shared_ptr_base.h:1350
#10 0x0000555555c0bc82 in SpectrumView::Draw (this=0x55555a41c480, context=..., rect=..., iPass=<optimized out>)
    at /usr/include/c++/14.2.1/bits/shared_ptr_base.h:1666
#11 0x00005555558ec997 in operator() (__closure=0x5555572d72a0, rect=..., node=...)
    at /usr/src/debug/audacity/audacity-Audacity-3.7.3/src/CellularPanel.cpp:1248
#12 std::__invoke_impl<void, CellularPanel::Draw(TrackPanelDrawingContext&, unsigned int)::<lambda(const wxRect&, TrackPanelNode&)>&, const wxRect&, TrackPanelNode&> (__f=...) at /usr/include/c++/14.2.1/bits/invoke.h:61
#13 std::__invoke_r<void, CellularPanel::Draw(TrackPanelDrawingContext&, unsigned int)::<lambda(const wxRect&, TrackPanelNode&)>&, const wxRect&, TrackPanelNode&> (__fn=...) at /usr/include/c++/14.2.1/bits/invoke.h:111
#14 std::_Function_handler<void(const wxRect&, TrackPanelNode&), CellularPanel::Draw(TrackPanelDrawingContext&, unsigned int)::<lambda(const wxRect&, TrackPanelNode&)> >::_M_invoke(const std::_Any_data &, const wxRect &, TrackPanelNode &) (__functor=<optimized out>, __args#0=..., __args#1=...)

Steps to reproduce

Unable to provide specific steps to reproduce. It seems to happen intermittently. I'm working with audio tracks which are about an hour long, if that's relevant. Hopefully the backtrace can provide some insight.

Expected behavior

It doesn't crash

Actual behavior

No response

Audacity Version

Audacity 3.7.3

Operating system

Linux

Additional context

No response

Metadata

Metadata

Labels

AU3-bugBugs from Audacity 3crash / freezecatastrophic errorsspectral toolsspectrogram, spectral brush, etc

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions