From 0b1c94eae2f909bec19589408777ff319059935e Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 12 Mar 2026 21:18:23 +0100 Subject: [PATCH] fix: short read bug in matchStructScalar and matchStructAlloc --- src/cbor.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cbor.zig b/src/cbor.zig index d7f2989..65cc773 100644 --- a/src/cbor.zig +++ b/src/cbor.zig @@ -663,7 +663,7 @@ fn matchStructScalar(comptime T: type, iter_: *[]const u8, val_: *T) Error!bool const info = @typeInfo(T).@"struct"; const len = decodeMapHeader(&iter) catch |err| switch (err) { - error.TooShort => return false, + error.TooShort => return err, error.InvalidMapType => return err, error.InvalidPIntType => return err, }; @@ -705,7 +705,7 @@ fn matchStructAlloc(comptime T: type, iter_: *[]const u8, val_: *T, allocator: s const info = @typeInfo(T).@"struct"; const len = decodeMapHeader(&iter) catch |err| switch (err) { - error.TooShort => return false, + error.TooShort => return err, error.InvalidMapType => return err, error.InvalidPIntType => return err, };