NPRPC docs

function check_optional_bounds

Swift

func check_optional_bounds(buffer: UnsafeRawPointer, bufferSize: Int, offset: Int, valueSize: Int) -> Bool

Check that an optional field has valid bounds Optionals have a 4-byte presence flag, followed by the relative data offset

buffer
Raw buffer pointer
bufferSize
Total buffer size in bytes
offset
Offset where optional header starts
valueSize
Size of the optional value (when present)

Returns true if valid, false if out of bounds

nprpc_swift/Sources/NPRPC/Marshalling.swift:378