Ticket #1590 (closed bug: invalid)

Opened 5 years ago

Last modified 4 years ago

Coredump in load_bytecode when embedding

Reported by: dukeleto Owned by:
Priority: major Milestone:
Component: core Version: 2.3.0
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:

Description

I am trying to load P6object.pbc in PL/Parrot, but I get a coredump. This is happening in the 'security' branch of PL/Parrot:

 http://github.com/leto/plparrot/tree/security

The function which is causing the coredump:

void plparrot_secure(Parrot_Interp interp)
{
    Parrot_PMC func_pmc;
    Parrot_String err;

    Parrot_load_bytecode(interp,"P6object.pbc");
    func_pmc  = Parrot_compile_string(interp, create_string("PIR"), PLPARROT_SECURE, &err);
    Parrot_ext_call(interp, func_pmc, "P->", interp);
}

This is Parrot r45974 on darwin/x86:

#0  0x01852578 in parrot_split_path_ext (interp=0x902830, in=0xff8adc, wo_ext=0xbfffd59c, ext=0xbfffd598) at src/library.c:905
905	    pos_sl = CHARSET_RINDEX(interp, in, slash1, len);
(gdb) bt
#0  0x01852578 in parrot_split_path_ext (interp=0x902830, in=0xff8adc, wo_ext=0xbfffd59c, ext=0xbfffd598) at src/library.c:905
#1  0x01874f9d in Parrot_load_bytecode (interp=0x902830, file_str=0xff8adc) at src/packfile.c:4838
#2  0x00ff7f93 in plparrot_secure (interp=0x902830) at plparrot.c:309
#3  0x00ff803a in _PG_init () at plparrot.c:111
#4  0x0031c1a3 in internal_load_library (libname=0x104d44c "/Users/leto/lib/postgresql/plparrot.so") at dfmgr.c:284
#5  0x0031ce2e in load_external_function (filename=0x61707365 <Address 0x61707365 out of bounds>, funcname=0x104da34 "plparrot_call_handler", signalNotFound=1 '\001', filehandle=0xbfffd768) at dfmgr.c:113
#6  0x000a568d in fmgr_c_validator (fcinfo=0x61707365) at pg_proc.c:718
#7  0x0031eba9 in OidFunctionCall1 (functionId=1634759525, arg1=1634759525) at fmgr.c:1557
#8  0x000a6851 in ProcedureCreate (procedureName=0x1006bac "plparrot_call_handler", procNamespace=2200, replace=0 '\0', returnsSet=0 '\0', returnType=2280, languageObjectId=13, languageValidator=2247, prosrc=0x1006bac "plparrot_call_handler", probin=0x1006cb8 "$libdir/plparrot", isAgg=0 '\0', isWindowFunc=0 '\0', security_definer=0 '\0', isStrict=0 '\0', volatility=118 'v', parameterTypes=0x104d60c, allParameterTypes=0, parameterModes=0, parameterNames=0, parameterDefaults=0x0, proconfig=0, procost=2.77220852e+20, prorows=2.77220852e+20) at pg_proc.c:626
#9  0x00111b5f in CreateFunction (stmt=0x1006dec, queryString=0x61707365 <Address 0x61707365 out of bounds>) at functioncmds.c:939
#10 0x002433e1 in MemoryContextSwitchTo [inlined] () at palloc.h:1191
#11 0x002433e1 in PortalRunUtility (portal=0x103de1c, utilityStmt=0x1006dec, isTopLevel=1 '\001', dest=0x1006fc0, completionTag=0xbfffdece "") at pquery.c:1199
#12 0x00243515 in PortalRunMulti (portal=0x103de1c, isTopLevel=1 '\001', dest=0x1006fc0, altdest=0x1006fc0, completionTag=0xbfffdece "") at pquery.c:1296
#13 0x00243fe4 in PortalRun (portal=0x103de1c, count=2147483647, isTopLevel=1 '\001', dest=0x1006fc0, altdest=0x1006fc0, completionTag=0xbfffdece "") at pquery.c:822
#14 0x0023f9ee in exec_simple_query (query_string=0x100621c "CREATE FUNCTION plparrot_call_handler ()\nRETURNS language_handler AS '$libdir/plparrot' LANGUAGE C;") at postgres.c:1051
#15 0x0024111c in PostgresMain (argc=1634759525, argv=0x10036f4, username=0x1003648 "leto") at postgres.c:3864
#16 0x001fe177 in ServerLoop () at postmaster.c:3522
#17 0x001ff350 in PostmasterMain (argc=3, argv=0x900920) at postmaster.c:1086
#18 0x0018e1eb in main (argc=3, argv=0x900920) at main.c:188

Change History

Changed 4 years ago by dukeleto

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

Changed 4 years ago by dukeleto

The docs for Parrot_load_bytecode were wrong, it takes a Parrot_String.

Note: See TracTickets for help on using tickets.