Fixed iterable elements DOS via depth, Fixed memory access bug, Improved default behaviour

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-11-02 23:41:53 +01:00
parent 30ad7aff2a
commit e19362a479
9 changed files with 355 additions and 11 deletions
+8 -3
View File
@@ -75,13 +75,18 @@ AssertEqualsQ(MsgPackGetFieldFullSize(*MsgPack), #MsgPack_InvalidSize, "Truncate
AssertEquals(MsgPackLastError(*MsgPack), #MsgPack_Error_BufferTooSmall, "Truncated UInt16 error is set")
FreeWrappedHex(*MsgPack)
; Deep nesting doesn't overflow the stack
; Deep nesting, up to `#MsgPack_MaxDepth` (128 by default), see "TestDepthLimit*.pb" for the rest
Hex = ""
For i = 1 To 10000
For i = 1 To 128
Hex = Hex + "91"
Next
*MsgPack = WrapHex(Hex + "01")
AssertEqualsQ(MsgPackGetFieldFullSize(*MsgPack), 10001, "Deeply nested arrays")
AssertEqualsQ(MsgPackGetFieldFullSize(*MsgPack), 129, "Arrays nested 128 levels deep")
FreeWrappedHex(*MsgPack)
*MsgPack = WrapHex("91" + Hex + "01")
AssertEqualsQ(MsgPackGetFieldFullSize(*MsgPack), #MsgPack_InvalidSize, "Arrays nested 129 levels deep are rejected")
AssertEquals(MsgPackLastError(*MsgPack), #MsgPack_Error_MaxDepthExceeded, "Max depth error is set")
FreeWrappedHex(*MsgPack)