diff options
author | tb <> | 2022-12-09 17:23:05 +0000 |
---|---|---|
committer | tb <> | 2022-12-09 17:23:05 +0000 |
commit | 71105cb2a9dbee4d10b998a0344722138d048080 (patch) | |
tree | 1b1f77ecb09dbe46672e89e87f61b8daa23f1ba3 | |
parent | af3392e24dc0f32002712971ca329757d0e91e79 (diff) | |
download | openbsd-71105cb2a9dbee4d10b998a0344722138d048080.tar.gz openbsd-71105cb2a9dbee4d10b998a0344722138d048080.tar.bz2 openbsd-71105cb2a9dbee4d10b998a0344722138d048080.zip |
bio chain test: add a consistency check for chain lengths
-rw-r--r-- | src/regress/lib/libcrypto/bio/bio_chain.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/regress/lib/libcrypto/bio/bio_chain.c b/src/regress/lib/libcrypto/bio/bio_chain.c index 34c7594417..f5c46d710b 100644 --- a/src/regress/lib/libcrypto/bio/bio_chain.c +++ b/src/regress/lib/libcrypto/bio/bio_chain.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bio_chain.c,v 1.10 2022/12/09 07:53:06 tb Exp $ */ | 1 | /* $OpenBSD: bio_chain.c,v 1.11 2022/12/09 17:23:05 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> | 3 | * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> |
4 | * | 4 | * |
@@ -396,6 +396,14 @@ link_chains_at(size_t i, size_t j, int use_bio_push) | |||
396 | oldtail_len = nitems(A) - i - 1; | 396 | oldtail_len = nitems(A) - i - 1; |
397 | } | 397 | } |
398 | 398 | ||
399 | /* The two chains A[] and B[] are split into three disjoint pieces. */ | ||
400 | if (nitems(A) + nitems(B) != new_len + oldtail_len + oldhead_len) { | ||
401 | fprintf(stderr, "%s case (%zu, %zu) inconsistent lengths: " | ||
402 | "%zu + %zu + %zu != %zu + %zu\n", fn, i, j, | ||
403 | nitems(A), nitems(B), new_len, oldtail_len, oldhead_len); | ||
404 | goto err; | ||
405 | } | ||
406 | |||
399 | /* | 407 | /* |
400 | * Now actually push or set next. | 408 | * Now actually push or set next. |
401 | */ | 409 | */ |