From: Bernd Edlinger Date: Sat, 11 Feb 2017 07:53:24 +0000 (+0100) Subject: Restore the test coverage of COMP_rle and SSL_COMP_add_compression_method X-Git-Tag: OpenSSL_1_0_2l~70 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=847406923534dd791f73d0cda15d3f17f513f2a5;p=openssl Restore the test coverage of COMP_rle and SSL_COMP_add_compression_method Reviewed-by: Rich Salz Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/2595) --- diff --git a/crypto/comp/c_rle.c b/crypto/comp/c_rle.c index e9aabbd166..41919613ee 100644 --- a/crypto/comp/c_rle.c +++ b/crypto/comp/c_rle.c @@ -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) { - memcpy(out, in, ilen - 1); - } + if (i != 0) + return -1; + + memcpy(out, in, ilen - 1); return (ilen - 1); } diff --git a/ssl/ssl_ciph.c b/ssl/ssl_ciph.c index 92b022b7cb..40021329a9 100644 --- a/ssl/ssl_ciph.c +++ b/ssl/ssl_ciph.c @@ -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); diff --git a/test/Makefile b/test/Makefile index 8f272ef99d..a324eeb39a 100644 --- a/test/Makefile +++ b/test/Makefile @@ -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