Skip to content

Commit 1576cf9

Browse files
committed
add exact-boundary tests at wolfssl_quic_max_record_capacity and cap+1 to catch off-by-onee mutations in the early data capacity check
1 parent ef4e11b commit 1576cf9

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

tests/quic.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,21 @@ static int test_quic_record_cap(void) {
412412
wolfSSL_free(ssl);
413413
ssl = NULL;
414414

415-
/* early_data within cap must succeed */
415+
/* early_data at exactly cap must succeed */
416+
ExpectNotNull(ssl = wolfSSL_new(ctx));
417+
ExpectTrue(provide_data(ssl, wolfssl_encryption_early_data, buf,
418+
WOLFSSL_QUIC_MAX_RECORD_CAPACITY, 0));
419+
wolfSSL_free(ssl);
420+
ssl = NULL;
421+
422+
/* early_data at cap+1 must be rejected */
423+
ExpectNotNull(ssl = wolfSSL_new(ctx));
424+
ExpectTrue(provide_data(ssl, wolfssl_encryption_early_data, buf,
425+
(size_t)WOLFSSL_QUIC_MAX_RECORD_CAPACITY + 1U, 1));
426+
wolfSSL_free(ssl);
427+
ssl = NULL;
428+
429+
/* early_data well within cap must succeed */
416430
ExpectNotNull(ssl = wolfSSL_new(ctx));
417431
ExpectTrue(provide_data(ssl, wolfssl_encryption_early_data, buf, 1024, 0));
418432
wolfSSL_free(ssl);

0 commit comments

Comments
 (0)