Restore the test coverage of COMP_rle and SSL_COMP_add_compression_method

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2595)
This commit is contained in:
Bernd Edlinger 2017-02-11 08:53:24 +01:00 committed by Richard Levitte
parent f65ee71264
commit 8474069235
3 changed files with 15 additions and 12 deletions

View File

@ -31,12 +31,11 @@ static int rle_compress_block(COMP_CTX *ctx, unsigned char *out,
unsigned int olen, unsigned char *in,
unsigned int ilen)
{
/* int i; */
if (ilen == 0)
return 0;
if (ilen == 0 || olen < (ilen - 1)) {
/* ZZZZZZZZZZZZZZZZZZZZZZ */
return (-1);
}
if (olen <= ilen)
return -1;
*(out++) = 0;
memcpy(out, in, ilen);
@ -49,14 +48,16 @@ static int rle_expand_block(COMP_CTX *ctx, unsigned char *out,
{
int i;
if (olen < (ilen - 1)) {
/* ZZZZZZZZZZZZZZZZZZZZZZ */
return (-1);
}
if (ilen == 0)
return 0;
if (olen < (ilen - 1))
return -1;
i = *(in++);
if (i == 0) {
if (i != 0)
return -1;
memcpy(out, in, ilen - 1);
}
return (ilen - 1);
}

View File

@ -2013,6 +2013,7 @@ int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm)
}
comp->id = id;
comp->method = cm;
comp->name = cm->name;
load_builtin_compressions();
if (ssl_comp_methods && sk_SSL_COMP_find(ssl_comp_methods, comp) >= 0) {
OPENSSL_free(comp);

View File

@ -307,6 +307,7 @@ test_ssl: keyU.ss certU.ss certCA.ss certP1.ss keyP1.ss certP2.ss keyP2.ss \
fi
../util/shlib_wrap.sh ./$(SSLTEST) -test_cipherlist
@sh ./testssl keyU.ss certU.ss certCA.ss
@sh ./testssl keyU.ss certU.ss certCA.ss -rle
@sh ./testsslproxy keyP1.ss certP1.ss intP1.ss
@sh ./testsslproxy keyP2.ss certP2.ss intP2.ss