Skip to content
New issue

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

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

Already on GitHub? # to your account

Same demangling for two swift names #23110

Closed
trufae opened this issue Jul 10, 2024 · 1 comment
Closed

Same demangling for two swift names #23110

trufae opened this issue Jul 10, 2024 · 1 comment

Comments

@trufae
Copy link
Collaborator

trufae commented Jul 10, 2024

These two symbols produce the same demangling output, which causes a conflict later on:

  • _OBJC_METACLASS_$__TtCC10FoundationP33_6DA0945A07226B3278459E9368612FF427__KVOKeyPathBridgeMachinery9BridgeKey
0     0x68396098         0x1ea00e098 NONE   FUNC 0        _OBJC_METACLASS_$__TtC10FoundationP33_6DA0945A07226B3278459E9368612FF427__KVOKeyPathBridgeMachinery
0     0x683978e0         0x1ea00f8e0 NONE   FUNC 0        _OBJC_METACLASS_$__TtCC10FoundationP33_6DA0945A07226B3278459E9368612FF427__KVOKeyPathBridgeMachinery9BridgeKey

that's translated to Foundation.__KVOKeyPathBridgeMachinery :: NSObject, NSObject by our demangler, but the apple one does: _OBJC_METACLASS_$_Foundation.(__KVOKeyPathBridgeMachinery in _6DA0945A07226B3278459E9368612FF4).BridgeKey

photo_2024-07-10_11-48-13
photo_2024-07-10_11-48-21

cc @mrmacete please update the ticket with more details, i'll try to find some time to fix it, meanwhile using the system demangler would work if you are on macos or ios

@trufae trufae added this to the 5.9.4 - icecore milestone Jul 10, 2024
@mrmacete
Copy link
Collaborator

i think that happens in general with nested types, the ones from the example above:

mangled: _TtC10FoundationP33_6DA0945A07226B3278459E9368612FF427__KVOKeyPathBridgeMachinery
swift-demangle output: Foundation.(__KVOKeyPathBridgeMachinery in _6DA0945A07226B3278459E9368612FF4)

mangled: _TtCC10FoundationP33_6DA0945A07226B3278459E9368612FF427__KVOKeyPathBridgeMachinery9BridgeKey
swift-demangle output: Foundation.(__KVOKeyPathBridgeMachinery in _6DA0945A07226B3278459E9368612FF4).BridgeKey

these 2 demangle to the same on r2's demangler.

Here's another example of symbols which r2 demangles all to CryptoKit.Curve448.Signing.PublicKey:

  • $s9CryptoKit8Curve448O7SigningO9PublicKeyV16isValidSignature_3forSbx_q_t10Foundation12DataProtocolRzAjKR_r0_lF
  • $s9CryptoKit8Curve448O7SigningO9PublicKeyV17rawRepresentation10Foundation4DataVvg
  • $s9CryptoKit8Curve448O7SigningO10PrivateKeyV06publicF0AE06PublicF0VvpMV
  • $s9CryptoKit8Curve448O7SigningO9PublicKeyV17rawRepresentationAGx_tKc10Foundation15ContiguousBytesRzlufC
  • $s9CryptoKit8Curve448O7SigningO9PublicKeyVMa
  • $s9CryptoKit8Curve448O7SigningO9PublicKeyVMn

trufae pushed a commit that referenced this issue Jul 17, 2024
… ##bin

* s9CryptoKit8Curve448O7SigningO9PublicKeyV16isValidSignature_3forSbx_q_t10Foundation12DataProtocolRzAjKR_r0_lF
* s9CryptoKit8Curve448O7SigningO9PublicKeyV17rawRepresentation10Foundation4DataVvg
* s9CryptoKit8Curve448O7SigningO10PrivateKeyV06publicF0AE06PublicF0VvpMV
* ...
@trufae trufae closed this as completed in d936bf6 Jul 17, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants