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

Error: binary parsing error: Buffer is too short for 52 arches #170

Open
a-zitzewitz opened this issue Nov 8, 2024 · 6 comments · May be fixed by #175
Open

Error: binary parsing error: Buffer is too short for 52 arches #170

a-zitzewitz opened this issue Nov 8, 2024 · 6 comments · May be fixed by #175
Labels
apple-codesign apple-codesign crate and rcodesign CLI tool bug Something isn't working

Comments

@a-zitzewitz
Copy link

I am trying to sign an application written in Java with the following command:

rcodesign sign --p12-file ~/rcodesign/hello2morrow.p12 --p12-password-file ~/rcodesign/password.txt Sonargraph.app

This is the output:

registering signing key
automatically registered Apple CA certificate: Developer ID Certification Authority
automatically registered Apple CA certificate: Apple Root CA
using time-stamp protocol server http://timestamp.apple.com/ts01
automatically setting team ID from signing certificate: WJYWD3F88N
signing Sonargraph.app in place
signing bundle at Sonargraph.app
signing bundle at Sonargraph.app into Sonargraph.app
signing Mach-O file Contents/Eclipse/bin/ccspy
creating cryptographic signature with certificate Developer ID Application: hello2morrow, Inc. (WJYWD3F88N)
signing Mach-O file Contents/Eclipse/plugins/com.sun.jna_5.14.0.v20231211-1200/com/sun/jna/AltCallingConvention.class
Error: binary parsing error: Buffer is too short for 52 arches

What can I do to fix that?

@a-zitzewitz
Copy link
Author

When I add --exclude "*.class" it seems to work

@indygreg indygreg added bug Something isn't working apple-codesign apple-codesign crate and rcodesign CLI tool labels Nov 9, 2024
@indygreg
Copy link
Owner

indygreg commented Nov 9, 2024

We're currently only reading the 4 byte header magic to determine if a file is a Mach-O. Clearly this is prone to false positives.

Sounds like we'll need to perform a more heavyweight validation to test if a file is a Mach-O.

@a-zitzewitz
Copy link
Author

a-zitzewitz commented Nov 10, 2024 via email

@netomi
Copy link
Contributor

netomi commented Dec 16, 2024

https://stackoverflow.com/questions/73546728/magic-value-collision-between-macho-fat-binaries-and-java-class-files

When discovering that the two filetypes share the same magic header, I had a WTF moment.

@a-zitzewitz
Copy link
Author

a-zitzewitz commented Dec 16, 2024 via email

@netomi
Copy link
Contributor

netomi commented Dec 16, 2024

I thought that 0xCAFEBABE was a synonym for Java and everybody in the industry would know, but that is probably my skewed PoV being heavily invested in this ecosystem for a long time.

Or it was a joke gone wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apple-codesign apple-codesign crate and rcodesign CLI tool bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants