CBOR: decodeFromByteArray<List<ByteArray>>
fails with "Expected start of array, but found XX" for indefinite-length array of byte strings on Android
#3012
Labels
Describe the bug
When attempting to decode a CBOR indefinite-length array (
9F ... FF
) containing byte strings into aList<ByteArray>
, thekotlinx-serialization-cbor
library throws aCborDecodingException
with the message "Expected start of array, but found XX" (where XX is the major type and length of the first byte string in the array). This occurs even though the inputByteArray
correctly starts with the9F
(indefinite-array) marker. The issue seems to be specific to the Android environment or a particular setup therein, as similar code might work in a pure JVM environment.To Reproduce
The following minimal Kotlin code, when run in an Android Activity's onCreate method, reproduces the issue with a simple indefinite-length array containing one empty byte string (9F40FF):
Logcat Output for 9F40FF:
Expected behavior
Environment
The text was updated successfully, but these errors were encountered: