Bug#301390: libjavascript-perl: Simple class binding causes SIGSEGV
Dmitry Panov
Dmitry Panov <dmitry@tula.ru>, 301390@bugs.debian.org
Fri, 25 Mar 2005 18:25:11 +0300
Package: libjavascript-perl
Version: 0.52-4
Severity: grave
Tags: experimental
Justification: renders package unusable
I tried to simulate 'document.write()', so I wrote a simple package Document.pm:
-- cut --
package Document;
sub new {
my $self = {};
bless $self;
return $self;
}
sub write {
my $self = $_[0];
my $text = $_[1];
$self->{buffer} .= $text;
}
1;
-- cut --
and a script:
-- cut --
#!/usr/bin/perl
use JavaScript;
use Document;
my $runtime = new JavaScript::Runtime;
my $context = $runtime->create_context();
$context->bind_class(
name => 'Document',
constructor => \&Document::new,
methods => {
write => \&Document::write
},
package => 'Document'
);
$context->eval('var document = new Document()');
-- cut --
Executing the script gives SIGSEGV. gdb where shows the following:
(gdb) where
#0 0x402feef5 in JS_GetClass () from /usr/lib/libsmjs.so.1
#1 0x4001be5c in ?? () from /usr/lib/perl5/auto/JavaScript/JavaScript.so
#2 0x0820a048 in ?? ()
#3 0x08214570 in ?? ()
#4 0x081f7f60 in ?? ()
#5 0x00000000 in ?? ()
#6 0x6a1e3e9c in ?? ()
#7 0x0814e298 in ?? ()
#8 0xbfffeb50 in ?? ()
#9 0x4036c298 in ?? () from /usr/lib/libsmjs.so.1
#10 0x081a92a8 in ?? ()
#11 0x08214908 in ?? ()
#12 0xbfffec28 in ?? ()
#13 0x40326de6 in js_Invoke () from /usr/lib/libsmjs.so.1
#14 0x40326de6 in js_Invoke () from /usr/lib/libsmjs.so.1
#15 0x4032b3fc in js_Interpret () from /usr/lib/libsmjs.so.1
#16 0x403274ac in js_Execute () from /usr/lib/libsmjs.so.1
#17 0x403028c4 in JS_EvaluateUCScriptForPrincipals ()
from /usr/lib/libsmjs.so.1
#18 0x4030281f in JS_EvaluateUCScript () from /usr/lib/libsmjs.so.1
#19 0x4030270a in JS_EvaluateScript () from /usr/lib/libsmjs.so.1
#20 0x4001fbaa in XS_JavaScript__Context_EvaluateScriptImpl ()
from /usr/lib/perl5/auto/JavaScript/JavaScript.so
#21 0x080c32d6 in Perl_pp_entersub ()
#22 0x080bbdc9 in Perl_runops_standard ()
#23 0x080635e8 in perl_run ()
#24 0x080633f5 in perl_run ()
#25 0x0805fb9f in main ()
-- System Information:
Debian Release: 3.1
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.4.25
Locale: LANG=ru_RU.KOI8-R, LC_CTYPE=ru_RU.KOI8-R (charmap=KOI8-R)
Versions of packages libjavascript-perl depends on:
ii libc6 2.3.2.ds1-20 GNU C Library: Shared libraries an
ii libsmjs1 1.5rc6a-1 The Mozilla SpiderMonkey JavaScrip
ii perl 5.8.4-8 Larry Wall's Practical Extraction
ii perl-base [perlapi-5.8.4] 5.8.4-8 The Pathologically Eclectic Rubbis
-- no debconf information