duktape icon indicating copy to clipboard operation
duktape copied to clipboard

crash in duk__expr_led function when it is armeabi with -DCMAKE_BUILD_TYPE=MinSizeRel/Release

Open Shuijwan opened this issue 6 years ago • 2 comments

I have an android application run with duktape, it is build against armeabi with -DCMAKE_BUILD_TYPE=MinSizeRel. But it crash in duk__expr_led when it try to duk_eval_raw a javascript code.

I set a breakpoint at switch code below: `DUK_LOCAL void duk__expr_led(duk_compiler_ctx *comp_ctx, duk_ivalue *left, duk_ivalue *res) { duk_hthread *thr = comp_ctx->thr; duk_token tk; duk_small_uint_t tok; duk_uint32_t args; / temp variable to pass constants and flags to shared code */

/*
 *  ctx->prev_token     token to process with duk__expr_led()
 *  ctx->curr_token     updated by caller
 */

comp_ctx->curr_func.led_count++;

/* The token in the switch has already been eaten here */
tk = &comp_ctx->prev_token;
tok = tk->t;

DUK_DDD(DUK_DDDPRINT("duk__expr_led(), prev_token.t=%ld, allow_in=%ld, paren_level=%ld",
                     (long) tk->t, (long) comp_ctx->curr_func.allow_in, (long) comp_ctx->curr_func.paren_level));

/* XXX: default priority for infix operators is duk__expr_lbp(tok) -> get it here? */

switch (tok) {`

when I step next, It throws signal SIGSEGV: invalid address (fault address 0x164) at tok.

When I change abi to armeabi-v7a or change -DCMAKE_BUILD_TYPE=Debug, it works well. Do you know why?

Shuijwan avatar Nov 26 '18 06:11 Shuijwan

same crash in my android application.

whitespeed avatar Oct 07 '20 06:10 whitespeed

No idea off hand why that would happen. One thing Duktape does assume is exact IEEE arithmetic, can you verify that works (especially integer/double casts, fmod(), and floor())?

svaarala avatar Oct 11 '20 21:10 svaarala