You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
An ArrayIndexOutOfBoundsException is thrown in appendStringSlowPath when serializing strings that contain many characters that wil be escaped in the generated JSON. It looks like this is caused by an insufficient ensureAdditionalCapacity(string.length + 2) in appendQuoted
To Reproduce
import kotlinx.serialization.Serializable
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
fun main() {
println(Json.encodeToString(SerializationTest("\"".repeat(100))))
}
@Serializable
data class SerializationTest(val s: String)
Expected behavior
String is successfully serialized as JSON, without error.
Environment
Kotlin version: 1.5.0
Library version: 1.2.0
Kotlin platforms: JVM
Gradle version: 6.8
The text was updated successfully, but these errors were encountered:
Character escaping in new serialization runtime contains a high priority
bug which renders the lib unusable. Reverting to previous version.
Ref: Kotlin/kotlinx.serialization#1441
Describe the bug
An ArrayIndexOutOfBoundsException is thrown in appendStringSlowPath when serializing strings that contain many characters that wil be escaped in the generated JSON. It looks like this is caused by an insufficient
ensureAdditionalCapacity(string.length + 2)
inappendQuoted
To Reproduce
Expected behavior
String is successfully serialized as JSON, without error.
Environment
The text was updated successfully, but these errors were encountered: