Ticket #1632 (closed bug: fixed)

Opened 5 years ago

Last modified 5 years ago

segfault in Parrot_ImageIO_shift_string

Reported by: coke Owned by:
Priority: blocker Milestone:
Component: none Version: trunk
Severity: fatal Keywords:
Cc: Language: tcl
Patch status: Platform:

Description

I just fixed partcl ( http://github.com/partcl/partcl) to compile again after recent changes to parrot. However, running ./tclsh immediately segfaults. Here's the backtrace:

(gdb) run
Starting program: /Users/coke/sandbox/partcl/tclsh
Reading symbols for shared libraries .+++++++. done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000008
0x00000001000fbe7d in Parrot_ImageIO_shift_string (interp=0x101300080, _self=0x1018ee7e0) at imageio.pmc:638
638                     return table->constants[i]->u.string;
(gdb) bt
#0  0x00000001000fbe7d in Parrot_ImageIO_shift_string (interp=0x101300080, _self=0x1018ee7e0) at imageio.pmc:638
#1  0x00000001000d53f1 in Parrot_FixedStringArray_thaw (interp=0x101300080, _self=<value temporarily unavailable, due to optimizations>, info=0x1018ee7e0) at fixedstringarray.pmc:640
#2  0x00000001000fb942 in visit_todo_list_thaw (interp=0x101300080, info=0x1018ee7e0) at imageio.pmc:276
#3  0x00000001000fbcbc in Parrot_ImageIO_set_string_native (interp=0x101300080, _self=0x1018ee7e0, image=<value temporarily unavailable, due to optimizations>) at imageio.pmc:713
#4  0x000000010007f6b7 in Parrot_thaw_pbc (interp=0x101300080, image=0x101891a30, pf=0x101319300) at src/pmc_freeze.c:259
#5  0x000000010007aecd in PackFile_Constant_unpack_pmc [inlined] () at /Users/coke/sandbox/parrot/src/packfile.c:3984
#6  0x000000010007aecd in PackFile_Constant_unpack (interp=0x101300080, constt=0x101319300, self=0x101336f80, cursor=0x1014b5d90) at src/packfile.c:3942
#7  0x000000010007b0fd in PackFile_ConstTable_unpack (interp=0x101300080, seg=0x101319300, cursor=0x1014b5d88) at src/packfile.c:3733
#8  0x000000010007d1b6 in PackFile_Segment_unpack [inlined] () at /Users/coke/sandbox/parrot/src/packfile.c:1946
#9  0x000000010007d1b6 in directory_unpack (interp=0x101300080, segp=0x101318f60, cursor=0x1014a93c0) at src/packfile.c:2169
#10 0x000000010007c5c9 in PackFile_Segment_unpack [inlined] () at /Users/coke/sandbox/parrot/src/packfile.c:1946
#11 0x000000010007c5c9 in PackFile_unpack (interp=0x101300080, self=0x101318f60, packed=0x101439000, packed_size=<value temporarily unavailable, due to optimizations>) at src/packfile.c:1134
#12 0x0000000100043ac0 in Parrot_pbc_read (interp=0x101300080, fullname=0x101318f20 "./runtime/tcllib.pbc", debug=<value temporarily unavailable, due to optimizations>) at src/embed.c:559
#13 0x000000010007d6ed in PackFile_append_pbc [inlined] () at /Users/coke/sandbox/parrot/src/packfile.c:4783
#14 0x000000010007d6ed in compile_or_load_file (interp=0x101300080, path=0x10188e748, file_type=PARROT_RUNTIME_FT_PBC) at src/packfile.c:4658
#15 0x000000010007d953 in Parrot_load_bytecode (interp=0x101300080, file_str=0x1018bfe08) at src/packfile.c:4861
#16 0x000000010003a55e in Parrot_load_bytecode_sc (cur_opcode=0x1018d8018, interp=<value temporarily unavailable, due to optimizations>) at core.ops:116
#17 0x0000000100080fed in runops_fast_core (interp=0x101300080, runcore_unused=<value temporarily unavailable, due to optimizations>, pc=<value temporarily unavailable, due to optimizations>) at src/runcore/cores.c:514
#18 0x0000000100080f0d in runops_int (interp=0x101300080, offset=0) at src/runcore/main.c:237
#19 0x0000000100057e8e in runops (interp=0x101300080, offs=<value temporarily unavailable, due to optimizations>) at src/call/ops.c:113
#20 0x00000001000536b3 in Parrot_pcc_invoke_from_sig_object (interp=0x101300080, sub_obj=0x1018855a0, call_object=<value temporarily unavailable, due to optimizations>) at src/call/pcc.c:359
#21 0x0000000100053b31 in Parrot_pcc_invoke_sub_from_c_args (interp=0x101300080, sub_obj=0x1018855a0, sig=<value temporarily unavailable, due to optimizations>) at src/call/pcc.c:87
#22 0x0000000100000ab3 in main (argc=1, argv=0x7fff5fbfeee8) at tcl.c:433

Change History

  Changed 5 years ago by NotFound

The imageio problem is that table->constants[i] contains NULL, looks like it references a Constant that hasn't been unpacked at that point. Added a check in r46591 that throws an exception in that case, avoiding the segfault, but that doesn't solve the partcl problem.

in reply to: ↑ description   Changed 5 years ago by plobsing

  • status changed from new to closed
  • resolution set to fixed

fixed in r46646.

Note: See TracTickets for help on using tickets.