milkytracker / MilkyTracker

An FT2 compatible music tracker
http://milkytracker.github.io/
Other
1.72k stars 162 forks source link

Encountering a segfault when openning a S3M file #7

Closed ghost closed 10 years ago

ghost commented 10 years ago

This is quite an old bug, I remember encountering it with older version of MilkyTracker.

I've tried to open one S3M file from Jazz Jackrabbit with MilkyTracker v0.90.86 on ArchLinux x86_64.

I'm not sure if I can distribute the S3M, so I'll just leave the name and md5sum here:

dbdf29b67541f89fb6e30a978f44c1c4  Fanolint.s3m

I ran MilkyTracker inside valgrind to get more information about the nature segfault. The output of valgrind --leak-check=full --show-leak-kinds=all -v milkytracker Fanolint.s3m is available here.

Deltafire commented 10 years ago

I'm unable to reproduce this segfault, I've tried with both the Carbon and SDL build (64-bit) on osx.

Could you build milkytracker with debug symbols and obtain a backtrace?

ghost commented 10 years ago

Valgrind with no parameters shows the following issues

Invalid read of size 1
   at 0x51DE66: TXMSample::postProcessSamples() (XModule.cpp:274)
   by 0x520FD4: XModule::postProcessSamples(bool) (XModule.cpp:1643)
   by 0x557483: LoaderS3M::load(XMFileBase&, XModule*) (LoaderS3M.cpp:724)
   by 0x521F6C: XModule::loadModule(XMFileBase&, bool) (XModule.cpp:1984)
   by 0x521E09: XModule::loadModule(char const*, bool) (XModule.cpp:1962)
   by 0x4209E7: ModuleEditor::openSong(char const*, char const*) (ModuleEditor.cpp:667)
   by 0x4B5C88: Tracker::loadTypeFromFile(FileTypes, PPString const&, bool, bool, bool) (Tracker.cpp:2694)
   by 0x4B53B4: Tracker::loadGenericFileType(PPString const&) (Tracker.cpp:2569)
   by 0x4AF56F: Tracker::handleEvent(PPObject*, PPEvent*) (Tracker.cpp:533)
   by 0x57DE04: PPScreen::raiseEvent(PPEvent*) (Screen.cpp:97)
   by 0x4DBA73: RaiseEventSerialized(PPEvent*) (SDL_Main.cpp:148)
   by 0x4DD0EA: SendFile(char*) (SDL_Main.cpp:974)
 Address 0x10914d65b is not stack'd, malloc'd or (recently) free'd
Process terminating with default action of signal 11 (SIGSEGV): dumping core
 Access not within mapped region at address 0x6
   at 0x51DE66: TXMSample::postProcessSamples() (XModule.cpp:274)
   by 0x520FD4: XModule::postProcessSamples(bool) (XModule.cpp:1643)
   by 0x557483: LoaderS3M::load(XMFileBase&, XModule*) (LoaderS3M.cpp:724)
   by 0x521F6C: XModule::loadModule(XMFileBase&, bool) (XModule.cpp:1984)
   by 0x521E09: XModule::loadModule(char const*, bool) (XModule.cpp:1962)
   by 0x4209E7: ModuleEditor::openSong(char const*, char const*) (ModuleEditor.cpp:667)
   by 0x4B5C88: Tracker::loadTypeFromFile(FileTypes, PPString const&, bool, bool, bool) (Tracker.cpp:2694)
   by 0x4B53B4: Tracker::loadGenericFileType(PPString const&) (Tracker.cpp:2569)
   by 0x4AF56F: Tracker::handleEvent(PPObject*, PPEvent*) (Tracker.cpp:533)
   by 0x57DE04: PPScreen::raiseEvent(PPEvent*) (Screen.cpp:97)
   by 0x4DBA73: RaiseEventSerialized(PPEvent*) (SDL_Main.cpp:148)
   by 0x4DD0EA: SendFile(char*) (SDL_Main.cpp:974)
 If you believe this happened as a result of a stack
 overflow in your program's main thread (unlikely but
 possible), you can try to increase the size of the
 main thread stack using the --main-stacksize= flag.
 The main thread stack size used in this run was 8388608.

The output of valgrind --leak-check=full --show-leak-kinds=all -v milkytracker Fanolint.s3m available here.

Deltafire commented 10 years ago

I've pushed a possible fix to the 'issue7' branch, but am unable to test if it works because I'm not experiencing the seg-fault. Could you checkout the issue7 branch and see if it fixes it?

ghost commented 10 years ago

Running autoconf outputs the following:

configure.ac:8: error: possibly undefined macro: AM_INIT_AUTOMAKE
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:33: error: possibly undefined macro: AM_PATH_ALSA
configure.ac:36: error: possibly undefined macro: AC_SUBST
configure.ac:39: error: possibly undefined macro: AC_MSG_FAILURE
configure.ac:41: error: possibly undefined macro: AC_MSG_WARN
configure.ac:50: error: possibly undefined macro: AM_PATH_SDL

It still creates a configure file, but it doesn't work, no matter which parameters I use, and only outputs the following:

./configure: line 2405: syntax error near unexpected token `dist-bzip2'
./configure: line 2405: `AM_INIT_AUTOMAKE(dist-bzip2 subdir-objects)'
Deltafire commented 10 years ago

It looks like automake isn't installed?

ghost commented 10 years ago

No, autoconf and automake are correctly installed. I have autoconf v2.69 and automake v1.14.

Maybe the version I use is more recent than yours, or maybe ArchLinux handles things differently than your distro.

Deltafire commented 10 years ago

I have the same versions. Have you tried running autoreconf -i? If that doesn't work I'll upload the generated files somewhere (or you could obtain them from the release tarball).

ghost commented 10 years ago

autoreconf -i solved it, I should have tried that…

Your fix fixes the crash! :) It works flawlessly (so far).

Deltafire commented 10 years ago

I've merged the fix into the main branch - thanks for your help :)