From 00c52d5ab7238a56fb4ee67207bb7a542c993904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Tue, 7 Jan 2025 09:16:55 +0100 Subject: [PATCH] Allow zero size lengths --- src/data.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/data.cpp b/src/data.cpp index 01c9d9c..2f22549 100644 --- a/src/data.cpp +++ b/src/data.cpp @@ -48,7 +48,7 @@ static bool length(CTX &ctx, qint32 &val) if (!varint(ctx, val)) return false; - return (val > 0); + return (val >= 0); } static bool str(CTX &ctx, QByteArray &val) @@ -98,7 +98,7 @@ static bool packed(CTX &ctx, QVector &vals) if (TYPE(ctx.tag) == LEN) { qint32 len; - if (!varint(ctx, len) || len <= 0) + if (!varint(ctx, len) || len < 0) return false; const char *ee = ctx.bp + len; if (ee > ctx.be) @@ -129,7 +129,7 @@ static bool skip(CTX &ctx) len = 8; break; case LEN: - if (!varint(ctx, len) || len <= 0) + if (!varint(ctx, len) || len < 0) return false; break; case I32: