Commit 215fdaa9 authored by Kenton Varda's avatar Kenton Varda

Merge pull request #301 from szenker/fix-core-dump-in-GetFunctorStartAddress

Fixed access violation in GetFunctorStartAddress()
parents f6a31613 3f5e5f42
...@@ -285,9 +285,14 @@ class PtmfHelper { ...@@ -285,9 +285,14 @@ class PtmfHelper {
#undef BODY #undef BODY
void* apply(void* obj) { void* apply(void* obj) {
#if defined(__arm__) || defined(__mips__) || defined(__aarch64__)
if (adj & 1) {
ptrdiff_t voff = (ptrdiff_t)ptr;
#else
ptrdiff_t voff = (ptrdiff_t)ptr; ptrdiff_t voff = (ptrdiff_t)ptr;
if (voff & 1) { if (voff & 1) {
voff &= ~1; voff &= ~1;
#endif
return *(void**)(*(char**)obj + voff); return *(void**)(*(char**)obj + voff);
} else { } else {
return ptr; return ptr;
......
...@@ -26,6 +26,10 @@ ...@@ -26,6 +26,10 @@
namespace kj { namespace kj {
namespace { namespace {
TEST(Async, GetFunctorStartAddress) {
EXPECT_TRUE(nullptr != _::GetFunctorStartAddress<>::apply([](){return 0;}));
}
TEST(Async, EvalVoid) { TEST(Async, EvalVoid) {
EventLoop loop; EventLoop loop;
WaitScope waitScope(loop); WaitScope waitScope(loop);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment