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
When decoding a nested structure if the desired key is not present in the structure and ignoreUnknownKeys is set to true, MsgPackDecoder will step outside the bounds of the nested structure and continue searching for the key in the parent structure until it hits the end of the payload. Causing Kotlin Serialization to report required keys are missing in the parent structure.
As an example, take the given json encoded payload:
{
"a": 1,
"b": {
"d": 2,
"e": 3
},
"f":4
}
And the following Kotlin serializable class
@Serializable
data class Example(val a: Int, val b: Example.Child, val f: Int) {
@Serializable
data class Child(val c: String? = null)
}
ClassMsgPackDecoder when trying to find "c" will start a recursive call to BasicMsgPackDecoder.decodeElementIndex which if ignoreUnknownKeys is true will continue recursively calling BasicMsgPackDecoder.decodeElementIndex until it either finds "c" or in this case hits the end of the payload. Kotlin serialization will report that it could not find the required key "f"
ClassMsgPackDecoder needs to get the result of BasicMsgPackDecoder.decodeElementIndex so that it can properly increment decodedElements
The text was updated successfully, but these errors were encountered:
If `ignoreUnknownKeys` flag is on, reading could overflow to further
structures and cause issues when these structures need to be parsed.
This closes#87
This fixes#82
If `ignoreUnknownKeys` flag is on, reading could overflow to further
structures and cause issues when these structures need to be parsed.
This closes#87
This fixes#82
When decoding a nested structure if the desired key is not present in the structure and ignoreUnknownKeys is set to true,
MsgPackDecoder
will step outside the bounds of the nested structure and continue searching for the key in the parent structure until it hits the end of the payload. Causing Kotlin Serialization to report required keys are missing in the parent structure.As an example, take the given json encoded payload:
And the following Kotlin serializable class
ClassMsgPackDecoder when trying to find "c" will start a recursive call to BasicMsgPackDecoder.decodeElementIndex which if ignoreUnknownKeys is true will continue recursively calling BasicMsgPackDecoder.decodeElementIndex until it either finds "c" or in this case hits the end of the payload. Kotlin serialization will report that it could not find the required key "f"
ClassMsgPackDecoder needs to get the result of BasicMsgPackDecoder.decodeElementIndex so that it can properly increment decodedElements
The text was updated successfully, but these errors were encountered: