summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2022-12-09 17:23:06 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2022-12-09 17:23:06 +0000
commit69ca8446663758475f66a23202fd4f6efc21205a (patch)
tree14a8f6a6ba81fa5a884917f27b971627f6f08fba /regress
parentb6a3418cb4b0d3f10e8a9b8b0660958784e62170 (diff)
bio chain test: add a consistency check for chain lengths
Diffstat (limited to 'regress')
-rw-r--r--regress/lib/libcrypto/bio/bio_chain.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/regress/lib/libcrypto/bio/bio_chain.c b/regress/lib/libcrypto/bio/bio_chain.c
index 34c7594417f..f5c46d710be 100644
--- a/regress/lib/libcrypto/bio/bio_chain.c
+++ b/regress/lib/libcrypto/bio/bio_chain.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bio_chain.c,v 1.10 2022/12/09 07:53:06 tb Exp $ */
+/* $OpenBSD: bio_chain.c,v 1.11 2022/12/09 17:23:05 tb Exp $ */
/*
* Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
*
@@ -396,6 +396,14 @@ link_chains_at(size_t i, size_t j, int use_bio_push)
oldtail_len = nitems(A) - i - 1;
}
+ /* The two chains A[] and B[] are split into three disjoint pieces. */
+ if (nitems(A) + nitems(B) != new_len + oldtail_len + oldhead_len) {
+ fprintf(stderr, "%s case (%zu, %zu) inconsistent lengths: "
+ "%zu + %zu + %zu != %zu + %zu\n", fn, i, j,
+ nitems(A), nitems(B), new_len, oldtail_len, oldhead_len);
+ goto err;
+ }
+
/*
* Now actually push or set next.
*/