Skip to content

MY_CXT API is broiled with typedef struct {char broiled;} my_cxt_t; on atleast 5.32.0 upto 5.41.7 #23308

Closed
@bulk88

Description

@bulk88

Description

Exception thrown at 0x000007FE9FFF17AE (vcruntime140.dll) in perl.exe:
0xC0000005: Access violation writing location 0x0000000000000000.
vcruntime140.dll!memset() Line 122
perl541.dll!Perl_my_cxt_init(interpreter * my_perl, int * indexp, unsigned __int64 size) Line 5499
mycxtcrash_pl_21a9.dll!boot_mycxtcrash_pl_21a9(interpreter * my_perl, cv * cv) Line 264
[Inline Frame] perl541.dll!Perl_rpp_invoke_xs(interpreter *) Line 1177
perl541.dll!Perl_pp_entersub(interpreter * my_perl) Line 6529
perl541.dll!Perl_runops_standard(interpreter * my_perl) Line 41
perl541.dll!Perl_call_sv(interpreter * my_perl, sv * sv, long arg_flags) Line 3253
perl541.dll!Perl_call_list(interpreter * my_perl, long oldscope, av * paramList) Line 5324
perl541.dll!S_process_special_blocks(interpreter * my_perl, long floor, const char * const fullname, gv * const gv, cv * const cv) Line 11424
perl541.dll!Perl_newATTRSUB_x(interpreter * my_perl, long floor, op * o, op * proto, op * attrs, op * block, bool o_is_gv) Line 11258
perl541.dll!Perl_utilize(interpreter * my_perl, int aver, long floor, op * version, op * idop, op * arg) Line 8259
perl541.dll!Perl_yyparse(interpreter * my_perl, int gramtype) Line 460
perl541.dll!S_parse_body(interpreter * my_perl, char * * env, void(*)(interpreter *) xsinit) Line 2690
perl541.dll!perl_parse(interpreter * my_perl, void(*)(interpreter *) xsinit, int argc, char * * argv, char * * env) Line 1933
perl541.dll!RunPerl(int argc, char * * argv, char * * env) Line 196
[Inline Frame] perl.exe!invoke_main() Line 78
perl.exe!__scrt_common_main_seh() Line 288
kernel32.dll!BaseThreadInitThunk�()
ntdll.dll!RtlUserThreadStart�()

Steps to Reproduce

use Devel::Peek;
use Inline  ('force', 'noclean');

use Inline C => Config => PRE_HEAD => "

#define PERL_NO_GET_CONTEXT 1
#define NO_XSLOCKS

";
use Inline C => Config => BUILD_NOISY => 1;

use Inline C => config => boot =>  <<'END_OF_BOOT_CODE';
{
	SV * tsv = newSV(0); /* DO NOT REMOVE THIS BLOCK */
	sv_setiv(tsv, 0);
	SvREFCNT_dec_NN(tsv);
}
{
	MY_CXT_INIT;
}
END_OF_BOOT_CODE

use Inline C => config => auto_include =>  <<'END_OF_PRE_C_CODE';


#define MY_CXT_KEY "Broiled::_guts" XS_VERSION

typedef struct {
    char broiled;
} my_cxt_t;


START_MY_CXT

END_OF_PRE_C_CODE

use Inline C => <<'END_OF_C_CODE';

void dontcrash() {
	dTHX;
	warn("didn't SEGV");
}
END_OF_C_CODE


$, = "\n";

use v5.30;
use strict;
use warnings;

dontcrash();

Expected behavior

dontcrash();

Perl configuration

I got SEGVs on 5.32 i386 strawberry, and VC perl 5.41.7 x64.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions