onscripter-1byte crashes on English Tsukihime before title screen

Bug #372936 reported by dn
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
onscripter (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Binary package hint: onscripter

ONScripter (1-byte version) crashes with a segmentation fault right before reaching the Tsukihime title screen. This is with the English-translation patch v1.2 from http://mirrormoon.org/projects/tsukihime applied.

The terminal output was:
-----------------------------
<init> : Avifile RELEASE-0.7.47-080115-14:47-4.2.3
<init> : Available CPU flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx constant_tsc arch_perfmon bts pni monitor vmx est tm2 xtpr
<init> : 1000.00 MHz Genuine Intel(R) CPU T2500 @ 2.00GHz processor detected
ONScripter version 20080121(2.82)
Initialize JOYSTICK
Display: 640 x 480 (32 bpp)
Audio: 44100 Hz 16 bit stereo
 *** can't find file [cursor0.bmp] ***
 *** can't find file [cursor1.bmp] ***
 *** can't find file [image\word\mirrormoon.png] ***
 *** can't find file [icon\0.bmp] ***
 *** can't find file [icon\0.bmp] ***
 *** can't find file [image\title\title1.png] ***
 *** can't find file [image\title\titlebtn1.png] ***
Segmentation fault
-----------------------------

The crash doesn't happen if I download the source from http://dev.haeleth.net/onscripter.shtml and compile it myself, or if I'm running the Windows onscripter-en build in Wine.

Apparently there's been trouble with running it on Linux for a while, and someone created a patch for onscripter two years ago that might be out of date by now: http://mirrormoon.org/news/2007-01-15-tsukihime_english_for_linux_and_osx

ProblemType: Crash
Architecture: i386
Date: Wed May 6 17:39:53 2009
DistroRelease: Ubuntu 8.04
ExecutablePath: /usr/games/onscripter-1byte
NonfreeKernelModules: fglrx
Package: onscripter 20080121-0ubuntu1
PackageArchitecture: i386
ProcCmdline: onscripter-1byte -r /home/username/tsuki/
ProcEnviron:
 SHELL=/bin/bash
 PATH=/home/username/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
 LANG=en_US.UTF-8
Signal: 11
SourcePackage: onscripter
StacktraceTop:
 SDL_SetAlpha () from /usr/lib/libSDL-1.2.so.0
 ?? ()
 ?? ()
 ?? ()
 ?? ()
Title: onscripter-1byte crashed with SIGSEGV in SDL_SetAlpha()
Uname: Linux 2.6.24-24-generic i686
UserGroups: adm admin audio cdrom dialout dip fax floppy kvm libvirtd lpadmin mysql netdev plugdev powerdev scanner video

Tags: apport-bug
Revision history for this message
dn (nobled) wrote :
dn (nobled)
description: updated
Revision history for this message
Ying-Chun Liu (paulliu) wrote :

I made a backtrace on Tsukihime v1.1 English version.

(gdb) bt
#0 0xb7e271ee in SDL_SetAlpha () from /usr/lib/libSDL-1.2.so.0
#1 0x0806705f in ONScripterLabel::btndefCommand (this=0xbff0fe00)
    at ONScripterLabel_command.cpp:2892
#2 0x0805e6bd in ONScripterLabel::parseLine (this=0xbff0fe00)
    at ONScripterLabel.cpp:924
#3 0x0805ec01 in ONScripterLabel::executeLabel (this=0xbff0fe00)
    at ONScripterLabel.cpp:881
#4 0x080785c9 in ONScripterLabel::timerEvent (this=0xbff0fe00)
    at ONScripterLabel_event.cpp:1013
#5 0x08078af8 in ONScripterLabel::eventLoop (this=0xbff0fe00)
    at ONScripterLabel_event.cpp:1090
#6 0x0804b1b2 in main (argc=1, argv=0xbff11d88) at onscripter.cpp:210
(gdb) up
#1 0x0806705f in ONScripterLabel::btndefCommand (this=0xbff0fe00)
    at ONScripterLabel_command.cpp:2892
2892 SDL_SetAlpha( btndef_info.image_surface, DEFAULT_BLIT_FLAG, SDL_ALPHA_OPAQUE );
(gdb) print btndef_info.image_surface
$1 = (SDL_Surface *) 0x0

So the problem is btndef_info.image_surface is NULL in ONScripterLabel_command.cpp:2892 ONScripterLabel::btndefCommand ()

I'll see if new version solves the problem or not.

Revision history for this message
Ying-Chun Liu (paulliu) wrote :

 *** can't find file [image\title\titlebtn1.png] ***

The above warning message mainly causes the crash.
It's because image\title\titlebtn1.png is not there.

In current version, the code is:
        if ( buf[0] != '\0' ){
            btndef_info.setImageName( buf );
            parseTaggedString( &btndef_info );
            btndef_info.trans_mode = AnimationInfo::TRANS_COPY;
            setupAnimationInfo( &btndef_info );
            SDL_SetAlpha( btndef_info.image_surface, DEFAULT_BLIT_FLAG, SDL_ALPHA_OPAQUE );
        }

In this case, buf = "image\title\titlebtn1.png" so btndef_info.setImageName() and following calls will result btndef_info.image_surface to be NULL because it's really not exists.
And then SDL_SetAlpha crash because it's NULL.

In Haeleth's version, the code is
        if ( buf[0] != '\0' ){
            btndef_info.setImageName( buf );
            parseTaggedString( &btndef_info );
            btndef_info.trans_mode = AnimationInfo::TRANS_COPY;
            setupAnimationInfo( &btndef_info );
#ifdef RCA_SCALE
            if (btndef_info.image_surface
                && (scr_stretch_x > 1.0 || scr_stretch_y > 1.0 )) {
                // Scale and reposition buttons if screen is bigger than game
                SDL_Surface* src = btndef_info.image_surface;
                SDL_PixelFormat *fmt = src->format;
                SDL_Surface* dst = SDL_CreateRGBSurface( SDL_SWSURFACE,
                                                         scr_stretch_x*src->w,
                                                         scr_stretch_y*src->h,
                                                         fmt->BitsPerPixel, fmt
                resizeSurface( src, dst );
                btndef_info.image_surface = dst;
                btndef_info.pos.w *= scr_stretch_x;
                btndef_info.pos.h *= scr_stretch_y;
                SDL_FreeSurface( src );
            }
            if (btndef_info.image_surface)
#endif
            SDL_SetAlpha( btndef_info.image_surface, DEFAULT_BLIT_FLAG, SDL_ALPHA_OPAQUE );
        } else btntime_value = 0; //Mion - clear the btn wait time

So when RCA_SCALE is defined, it checks btndef_info.image_surface before calls to SDL_SetAlpha() which won't cause the crash.

Changed in onscripter (Ubuntu):
status: New → Confirmed
dn (nobled)
description: updated
summary: - English Tsukihime crashes before title screen
+ onscripter-1byte crashes on English Tsukihime before title screen
Revision history for this message
Sean Sullivan (siliconpie) wrote :

This is not Ubuntu, this is because you don't know how to read the instructions. You need to patch the source.
http://mirrormoon.org/news/2007-01-15-tsukihime_english_for_linux_and_osx
For god's sake, use Google before you report a bug.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.