Skip to content

encodeUtf and decodeUtf incorrectly catch asynchronous exceptions #22

Closed

Description

@wz1000

encodeWith and decodeWith use try @SomeException to catch all exceptions that may arise while dealing with C buffers.

See for instance

r <- try @SomeException $ GHC.withCStringLen enc str $ \cstr -> WindowsString <$> BS8.packCStringLen cstr

This is incorrect, as asynchronous exceptions thrown to such code (for instance using killThread or ^C) should not result in a EncodingException.

The simplest way to fix it is to see if the exception is SomeAsyncException and if so reraise it.

See also https://gitlab.haskell.org/ghc/ghc/-/issues/25479

Activity

  1. hasufell commented on Nov 14, 2024

    @hasufell
    Member

    Can you provide a PR?

  2. added 2 commits that reference this issue on Nov 15, 2024
    42b0b12
    edc9532
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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions