{"action":"created","issue":{"url":"https://api.github.com/repos/svaarala/duktape/issues/751","repository_url":"https://api.github.com/repos/svaarala/duktape","labels_url":"https://api.github.com/repos/svaarala/duktape/issues/751/labels{/name}","comments_url":"https://api.github.com/repos/svaarala/duktape/issues/751/comments","events_url":"https://api.github.com/repos/svaarala/duktape/issues/751/events","html_url":"https://github.com/svaarala/duktape/issues/751","id":153388434,"number":751,"title":"Crash near DUK_UNLIKELY?","user":{"login":"faywong","id":1934627,"avatar_url":"https://avatars.githubusercontent.com/u/1934627?v=3","gravatar_id":"","url":"https://api.github.com/users/faywong","html_url":"https://github.com/faywong","followers_url":"https://api.github.com/users/faywong/followers","following_url":"https://api.github.com/users/faywong/following{/other_user}","gists_url":"https://api.github.com/users/faywong/gists{/gist_id}","starred_url":"https://api.github.com/users/faywong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/faywong/subscriptions","organizations_url":"https://api.github.com/users/faywong/orgs","repos_url":"https://api.github.com/users/faywong/repos","events_url":"https://api.github.com/users/faywong/events{/privacy}","received_events_url":"https://api.github.com/users/faywong/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2016-05-06T06:43:16Z","updated_at":"2016-05-23T15:06:34Z","closed_at":"2016-05-18T02:30:12Z","body":"I use duktape on android devices, the crash reports reflects a frequently crash at duk_api_stack.c:264:\r\n\r\n```c\r\nfile: duktape.c\r\n17449 \r\n17450     DUK_ASSERT_CTX_VALID(ctx);\r\n17451     DUK_ASSERT(DUK_INVALID_INDEX < 0);\r\n17452 \r\n17453     vs_size = (duk_idx_t) (thr->valstack_top - thr->valstack_bottom);\r\n17454     DUK_ASSERT(vs_size >= 0);\r\n17455 \r\n17456     if (index < 0) {\r\n17457         index = vs_size + index;\r\n17458         if (DUK_UNLIKELY(index < 0)) { // crash at this line\r\n17459             return NULL;\r\n17460         }\r\n17461     } else {\r\n17462         DUK_ASSERT(index != DUK_INVALID_INDEX);\r\n17463         if (DUK_UNLIKELY(index >= vs_size)) {\r\n17464             return NULL;\r\n17465         }\r\n17466     }\r\n17467 \r\n17468     DUK_ASSERT(index >= 0);\r\n```\r\n\r\nthe crash stack:\r\n```bash\r\nsignal 11 (SIGSEGV)  code 1 (SEGV_MAPERR)  fault addr 0000004c\r\nr0 6f6cf1b8  r1 00000000  r2 400bdbd4  r3 80596fc0\r\nr4 00000000  r5 6ddb5df0  r6 400bdbd4  r7 6f6cf1b8\r\nr8 400bdbd4  r9 00000000  10 00000388  fp 00000067\r\nip befcc730  sp befcbe00  lr 6dd965b5  pc 6dd961e2  cpsr 400f0030\r\n00  pc 000241e2  my.so\r\n00  pc 000241e2  my.so\r\n01  lr 000245b5  my.so\r\n```\r\n\r\nCan anybody give me some clue on this crash?"},"comment":{"url":"https://api.github.com/repos/svaarala/duktape/issues/comments/221005910","html_url":"https://github.com/svaarala/duktape/issues/751#issuecomment-221005910","issue_url":"https://api.github.com/repos/svaarala/duktape/issues/751","id":221005910,"user":{"login":"svaarala","id":6377415,"avatar_url":"https://avatars.githubusercontent.com/u/6377415?v=3","gravatar_id":"","url":"https://api.github.com/users/svaarala","html_url":"https://github.com/svaarala","followers_url":"https://api.github.com/users/svaarala/followers","following_url":"https://api.github.com/users/svaarala/following{/other_user}","gists_url":"https://api.github.com/users/svaarala/gists{/gist_id}","starred_url":"https://api.github.com/users/svaarala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svaarala/subscriptions","organizations_url":"https://api.github.com/users/svaarala/orgs","repos_url":"https://api.github.com/users/svaarala/repos","events_url":"https://api.github.com/users/svaarala/events{/privacy}","received_events_url":"https://api.github.com/users/svaarala/received_events","type":"User","site_admin":false},"created_at":"2016-05-23T15:06:34Z","updated_at":"2016-05-23T15:06:34Z","body":"If so, it should be preceded by an alloc/realloc call returning NULL."}}
{"actor":{"display_login":"svaarala"}}