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

Fix for negative INTEGER values problem in binary format #18

Closed
GoogleCodeExporter opened this issue May 23, 2015 · 1 comment
Closed

Comments

@GoogleCodeExporter
Copy link

Hi,

I've attached a patch that fixes a problem with negative integer NSNumbers 
(there already was a remark in the code). In Java, all int and long values are 
signed. Therefore, the simple test, e.g. "<256" for a 1-byte-representation is 
not sufficient. Instead, all negative values have to be stored in 8 bytes since 
the most significant bit (the sign) is is set.

Similarily, BinaryPropertyListWriter.writeIntHeader(int) can not handle 
negative values. Instead of correcting this, I've only added an assertion. This 
is because any use of that method only deals with sizes of objects, which are 
>= 0 by nature.

Please consider to apply this patch.

Have fun!


PS: Small copy-and-paste-bug on the example Wiki page: When adding "Lisa", you 
should consistently use "person2"...

Original issue reported on code.google.com by volker.r...@gmail.com on 18 Aug 2011 at 12:48

Attachments:

@GoogleCodeExporter
Copy link
Author

Thanks for the patch, fixed with r42.

Original comment by kei...@alum.mit.edu on 23 Aug 2011 at 6:49

  • Changed state: Fixed

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

No branches or pull requests

1 participant