diff --git a/Interop/Runtime/src/main/kotlin/kotlinx/cinterop/Utils.kt b/Interop/Runtime/src/main/kotlin/kotlinx/cinterop/Utils.kt index 72dda83a49b..3062fd3fd68 100644 --- a/Interop/Runtime/src/main/kotlin/kotlinx/cinterop/Utils.kt +++ b/Interop/Runtime/src/main/kotlin/kotlinx/cinterop/Utils.kt @@ -532,8 +532,8 @@ public fun CPointer.toKStringFromUtf32(): String { var toIndex = 0 while (true) { val value = nativeBytes[fromIndex++] - toIndex++ if (value == 0) break + toIndex++ if (value >= 0x10000 && value <= 0x10ffff) { toIndex++ }