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

Empty CFStringRefthrows Exception if stringValue is called (macOS) #1274

Closed
dyorgio opened this issue Nov 24, 2020 · 1 comment · Fixed by #1275
Closed

Empty CFStringRefthrows Exception if stringValue is called (macOS) #1274

dyorgio opened this issue Nov 24, 2020 · 1 comment · Fixed by #1275
Labels

Comments

@dyorgio
Copy link
Contributor

dyorgio commented Nov 24, 2020

  1. Version of JNA and related jars
    5.6.0 platform jar.
  2. Version and vendor of the java virtual machine
    Azul Zulu (zulu8.46.0.19-ca-fx-jdk8.0.252-macosx_x64)
  3. Operating system
    macOS Big Sur (11.0.1)
  4. System architecture (CPU type, bitness of the JVM)
    x64, x64
  5. Complete description of the problem
    Method CFStringRef.stringValue throws java.lang.IllegalArgumentException: Allocation size must be greater than zero if used in a empty string (char[0)) instance.
  6. Steps to reproduce
    Just call:
String var = CoreFoundation.CFStringRef.createCFString("").stringValue();
@dyorgio dyorgio changed the title Empty CFStringRefthrows Exception if stringValue is called (macos) Empty CFStringRefthrows Exception if stringValue is called (macOS) Nov 24, 2020
@dbwiddis
Copy link
Contributor

Thanks for the report and the fix. Surprised I didn't run into that edge case before!

@dbwiddis dbwiddis added the bug label Nov 24, 2020
@dbwiddis dbwiddis linked a pull request Nov 24, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants