Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash on 10.10 yosemite and Xcode 6 dp4 #152

Open
V01dZer0 opened this issue Aug 1, 2014 · 6 comments
Open

crash on 10.10 yosemite and Xcode 6 dp4 #152

V01dZer0 opened this issue Aug 1, 2014 · 6 comments

Comments

@V01dZer0
Copy link

V01dZer0 commented Aug 1, 2014

screen shot 2014-08-01 at 3 16 20 pm

@yoon-boom
Copy link

i get the same error when i try to do encode Dictionary to JSON string. iOS 8.0

@0xd01
Copy link

0xd01 commented Oct 21, 2014

I also got the error too, running on Mac OSX Yosemite with the same case as @yoon-boom

@richrice
Copy link

This change worked for me...

---from---
void keyObjectISA = *((void *)keys[idx]);
---to---
void* key = keys[idx];
void* keyObjectISA = key;
---or---
void* keyObjectISA = keys[idx]; // should work as well

@cristiankocza-sv
Copy link

This is due to the recent addition of NSTaggedPointerString, which allows inline storage of strings within the pointer value. Thus a short string, like @"email" gets strored inline within a pointer value like 0x0000656D61696C55. Depending on your application memory usage, this value might or might not point to a valid memory location. More, due to the double indirection in the problematic line, the chances of getting to an invalid memory location are quite high, resulting in crashes.

What JSONKit tries to do at that line is to retrieve the Class object for the given key, and for performance reasons it tries to directly access the "isa" pointer. The fix would be to use runtime's object_getClass() function, instead of using the direct access:

void *keyObjectISA = (void*)object_getClass(keys[idx]);

@jcbertin
Copy link

Fixed in #158.

@haxpor
Copy link

haxpor commented Feb 28, 2016

@jcbertin I faced this problem, your fix fixed the problem for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants