Skip to content

SSL casts the socket handle to its own copy of SocketWrapper #158

Closed

Description

@dimensionscape

src/hx/libs/ssl/SSL.cpp and src/hx/libs/std/Socket.cpp each define a different struct SocketWrapper (only Socket.cpp's overrides __GetType), which breaks the one-definition rule, and _hx_ssl_set_socket casts any Dynamic to SSL's copy without a type check. UBSan's vptr check reports it (#148). It works only while the layouts match, and a non-socket argument crashes. Share one definition and check the handle type, as val_sock in Socket.cpp does.

Activity

  1. added this to the 6.0.0 milestone on Oct 15, 2026
  2. dimensionscape commented on Oct 15, 2026

    @dimensionscape
    MemberAuthor

    Correction: Socket.cpp's SocketWrapper is in an anonymous namespace, so it is not a one-definition clash. The bug is the unchecked cast in SSL.cpp to an unrelated type.

  3. added a commit that references this issue on Oct 15, 2026
    a44d60d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions