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

CGFloat %property wrongly assumes float, crashes on 32-bit #13

Closed
joshuaseltzer opened this issue Mar 22, 2017 · 2 comments
Closed

CGFloat %property wrongly assumes float, crashes on 32-bit #13

joshuaseltzer opened this issue Mar 22, 2017 · 2 comments
Labels
bug Something isn't working

Comments

@joshuaseltzer
Copy link

What are the steps to reproduce this issue?

  1. Create a %property (with nonatomic, assign) into a hooked class that is of type CGFloat
  2. Attempt to access this property from within the hooked code (i.e. self.MyFloat) on a 32-bit device.

What happens?

The dylib will crash.

What were you expecting to happen?

The dylib accesses the float value as expected.

Any logs, error output, etc?

You might see this in the logs:
[NSISRestrictedToZeroMarkerVariable floatValue]: unrecognized selector sent to instance 0x197a33e0

Any other comments?

@uroboro believes that this is due to the way %property is generated for CGFloat values and that is wrongly assumed to be of type float. See: https://github.com/theos/theos/blob/master/bin/lib/Logos/Generator/Base/Property.pm for the definition of a %property that is a CGFloat. My code will run perfectly fine on 64-bit devices (iPhone 6s on 9.3.3, iPhone 6s on 10.2, iPad Air on 9.3.2) but fails on 32-bit devices (iPad 4 on 9.3.3).

What versions of software are you using?

Operating System: 9.3.3 (iPad3,4 with Home Depot jailbreak)

Toolchain Version: 9.3

SDK Version: 9.3

@kirb
Copy link
Member

kirb commented Apr 11, 2017

We discussed this when it was filed – +[NSValue valueWithBytes:objCType:] and -[NSValue getValue:] were brought up as a way we can store primitive values generically. As we know the exact type, we can get back exactly what was stored rather than approximating it with NSNumber like we do now.

uroboro referenced this issue in theos/theos Dec 7, 2017
@uroboro uroboro transferred this issue from theos/theos Nov 2, 2018
@uroboro uroboro added the bug Something isn't working label Nov 3, 2018
@uroboro
Copy link
Member

uroboro commented Nov 24, 2018

Fixed in c0dcd06 via %property rewrite.

@uroboro uroboro closed this as completed Nov 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants