#1107: Opcode get_class has failed assertion with garbage input
-----------------------------+----------------------------------------------
 Reporter:  Austin_Hastings  |        Type:  bug   
   Status:  new              |    Priority:  normal
Milestone:                   |   Component:  core  
  Version:  1.6.0            |    Severity:  medium
 Keywords:                   |        Lang:        
    Patch:                   |    Platform:        
-----------------------------+----------------------------------------------
 This code is wrong:
 {{{
         sub compile_default_multi($class_name, $multi_name) {
                 NOTE("Class name: ", $class_name);
                 NOTE("Multi name: ", $multi_name);
                 my $class := Q:PIR {
                         $P0 = find_lex '$class_name'
                         %r = get_class $S0
                 };
 }}}

 (Where "NOTE" is a very expensive conditional 'say')

 The PIR block references $S0 where is should reference $P0.

 The result is an assertion failure. I believe that asking for the class of
 garbage is valid - it names a class that doesn't exist. The result should
 be a NULL PMC (or an exception, though the documentation of get_class does
 not mention any).

 {{{
 | | | | | | | | | +- Dump::Class::compile_default_multi: Class name:
 Slam::Scope
 | | | | | | | | | +- Dump::Class::compile_default_multi: Multi name:
 attach
 src/oo.c:420: failed assertion 'name'
 Backtrace - Obtained 18 stack frames (max trace depth is 32).
 /usr/local/lib/libparrot.so.1.6.0 [0xb7cdec52]
 /usr/local/lib/libparrot.so.1.6.0(Parrot_confess+0x9a) [0xb7cdedba]
 /usr/local/lib/libparrot.so.1.6.0(Parrot_oo_get_class_str+0x5f)
 [0xb7d16c1f]
 /usr/local/lib/libparrot.so.1.6.0 [0xb7c8cf05]
 /usr/local/lib/libparrot.so.1.6.0 [0xb7d2762e]
 /usr/local/lib/libparrot.so.1.6.0 [0xb7d2598f]
 /usr/local/lib/libparrot.so.1.6.0 [0xb7cff6d5]
 /usr/local/lib/libparrot.so.1.6.0 [0xb7cffaf0]
 /usr/local/lib/libparrot.so.1.6.0(Parrot_runops_fromc_args+0xc6)
 [0xb7d00896]
 /usr/local/lib/libparrot.so.1.6.0 [0xb7d1ec7e]
 /usr/local/lib/libparrot.so.1.6.0 [0xb7d1ef41]
 /usr/local/lib/libparrot.so.1.6.0(do_sub_pragmas+0x1b0) [0xb7d1f110]
 /usr/local/lib/libparrot.so.1.6.0(PackFile_fixup_subs+0x7c) [0xb7d1f20c]
 /usr/local/lib/libparrot.so.1.6.0 [0xb7f46b3a]
 /usr/local/lib/libparrot.so.1.6.0(imcc_run+0x39c) [0xb7f4774c]
 parrot [0x8048938]
 /lib/libc.so.6(__libc_start_main+0xe5) [0xb7a6d775]
 parrot [0x80487d1]
 Aborted
 }}}

-- 
Ticket URL: <https://trac.parrot.org/parrot/ticket/1107>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets

Reply via email to