fix: short read bug in matchStructScalar and matchStructAlloc

This commit is contained in:
CJ van den Berg 2026-03-12 21:18:23 +01:00
parent d1f35f9725
commit 0b1c94eae2
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -663,7 +663,7 @@ fn matchStructScalar(comptime T: type, iter_: *[]const u8, val_: *T) Error!bool
const info = @typeInfo(T).@"struct"; const info = @typeInfo(T).@"struct";
const len = decodeMapHeader(&iter) catch |err| switch (err) { const len = decodeMapHeader(&iter) catch |err| switch (err) {
error.TooShort => return false, error.TooShort => return err,
error.InvalidMapType => return err, error.InvalidMapType => return err,
error.InvalidPIntType => 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 info = @typeInfo(T).@"struct";
const len = decodeMapHeader(&iter) catch |err| switch (err) { const len = decodeMapHeader(&iter) catch |err| switch (err) {
error.TooShort => return false, error.TooShort => return err,
error.InvalidMapType => return err, error.InvalidMapType => return err,
error.InvalidPIntType => return err, error.InvalidPIntType => return err,
}; };