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

SEGFAULT when starting playback on a line with arpeggio effect #92

Closed
consolethinks opened this issue Apr 3, 2019 · 1 comment
Closed

Comments

@consolethinks
Copy link

consolethinks commented Apr 3, 2019

When I start a playback on/before a line where there's only an arpeggio effect (0000 specifically), BambooTracker segfaults with the following valgrind backtrace:

==6433== Memcheck, a memory error detector
==6433== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==6433== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
==6433== Command: ./BambooTracker
==6433== 
Translation "qt_en_GB" from "/usr/share/qt/translations"
Translation "bamboo_tracker_en_GB" from "/home/reedwolf/projects/BambooTracker/BambooTracker/../share/BambooTracker/lang"
==6433== Invalid read of size 8
==6433==    at 0x1BF3C0: InstrumentFM::getArpeggioEnabled(FMOperatorType) const (in /home/reedwolf/projects/BambooTracker/BambooTracker/BambooTracker)
==6433==    by 0x1B6A97: OPNAController::setArpeggioEffectFM(int, int, int) (in /home/reedwolf/projects/BambooTracker/BambooTracker/BambooTracker)
==6433==    by 0x17256A: BambooTracker::readFMEffect(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, bool) (in /home/reedwolf/projects/BambooTracker/BambooTracker/BambooTracker)
==6433==    by 0x174100: BambooTracker::readFMStep(Step&, int, bool) (in /home/reedwolf/projects/BambooTracker/BambooTracker/BambooTracker)
==6433==    by 0x17D797: BambooTracker::readStep() (in /home/reedwolf/projects/BambooTracker/BambooTracker/BambooTracker)
==6433==    by 0x17DB35: BambooTracker::streamCountUp() (in /home/reedwolf/projects/BambooTracker/BambooTracker/BambooTracker)
==6433==    by 0x14B5CA: MainWindow::onNewTickSignaled() (in /home/reedwolf/projects/BambooTracker/BambooTracker/BambooTracker)
==6433==    by 0x595B97F: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/libQt5Core.so.5.12.2)
==6433==    by 0x595B97F: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/libQt5Core.so.5.12.2)
==6433==    by 0x1822C9: AudioStreamMixier::readData(char*, long long) (in /home/reedwolf/projects/BambooTracker/BambooTracker/BambooTracker)
==6433==    by 0x5879BB8: QIODevicePrivate::read(char*, long long, bool) (in /usr/lib/libQt5Core.so.5.12.2)
==6433==    by 0x176EB1C2: ??? (in /usr/lib/qt/plugins/audio/libqtmedia_pulse.so)
==6433==  Address 0xb8 is not stack'd, malloc'd or (recently) free'd
==6433== 
==6433== 
==6433== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==6433==  Access not within mapped region at address 0xB8
==6433==    at 0x1BF3C0: InstrumentFM::getArpeggioEnabled(FMOperatorType) const (in /home/reedwolf/projects/BambooTracker/BambooTracker/BambooTracker)
==6433==    by 0x1B6A97: OPNAController::setArpeggioEffectFM(int, int, int) (in /home/reedwolf/projects/BambooTracker/BambooTracker/BambooTracker)
==6433==    by 0x17256A: BambooTracker::readFMEffect(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, bool) (in /home/reedwolf/projects/BambooTracker/BambooTracker/BambooTracker)
==6433==    by 0x174100: BambooTracker::readFMStep(Step&, int, bool) (in /home/reedwolf/projects/BambooTracker/BambooTracker/BambooTracker)
==6433==    by 0x17D797: BambooTracker::readStep() (in /home/reedwolf/projects/BambooTracker/BambooTracker/BambooTracker)
==6433==    by 0x17DB35: BambooTracker::streamCountUp() (in /home/reedwolf/projects/BambooTracker/BambooTracker/BambooTracker)
==6433==    by 0x14B5CA: MainWindow::onNewTickSignaled() (in /home/reedwolf/projects/BambooTracker/BambooTracker/BambooTracker)
==6433==    by 0x595B97F: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/libQt5Core.so.5.12.2)
==6433==    by 0x595B97F: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/libQt5Core.so.5.12.2)
==6433==    by 0x1822C9: AudioStreamMixier::readData(char*, long long) (in /home/reedwolf/projects/BambooTracker/BambooTracker/BambooTracker)
==6433==    by 0x5879BB8: QIODevicePrivate::read(char*, long long, bool) (in /usr/lib/libQt5Core.so.5.12.2)
==6433==    by 0x176EB1C2: ??? (in /usr/lib/qt/plugins/audio/libqtmedia_pulse.so)
==6433==  If you believe this happened as a result of a stack
==6433==  overflow in your program's main thread (unlikely but
==6433==  possible), you can try to increase the size of the
==6433==  main thread stack using the --main-stacksize= flag.
==6433==  The main thread stack size used in this run was 8388608.
==6433== 
==6433== HEAP SUMMARY:
==6433==     in use at exit: 108,887,330 bytes in 686,664 blocks
==6433==   total heap usage: 6,067,636 allocs, 5,380,972 frees, 904,069,381 bytes allocated
==6433== 
==6433== LEAK SUMMARY:
==6433==    definitely lost: 256 bytes in 1 blocks
==6433==    indirectly lost: 46 bytes in 2 blocks
==6433==      possibly lost: 96,439 bytes in 2,363 blocks
==6433==    still reachable: 108,790,589 bytes in 684,298 blocks
==6433==                       of which reachable via heuristic:
==6433==                         newarray           : 348,336 bytes in 2,534 blocks
==6433==                         multipleinheritance: 112,632 bytes in 222 blocks
==6433==         suppressed: 0 bytes in 0 blocks
==6433== Rerun with --leak-check=full to see details of leaked memory
==6433== 
==6433== For counts of detected and suppressed errors, rerun with: -v
==6433== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 2 from 2)
zsh: segmentation fault (core dumped)  valgrind ./BambooTracker

And here's a screenshot of a situation where this could happen:
Screenshot_20190403_141333
If I start the playback with F5 or F6, it will work, but with F7 (playback from current line), the bug appears.
Edit: If the 0000 (arpeggio off) effect command is not preceded by any other type of arpeggio command in the pattern, then playing back just that pattern (F6) will also (in some cases) cause bamboo tracker to crash. This can only happen in modules with more than 1 patterns, with a pattern (not first) having somewhere an arpeggio off command (0000).

@rerrahkr
Copy link
Member

rerrahkr commented Apr 3, 2019

Thanks for your report. This was due to trying to reference memory before the instrument was set to the track. I fixed it at 2fc32b6.

@rerrahkr rerrahkr closed this as completed May 3, 2019
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

No branches or pull requests

2 participants