summaryrefslogtreecommitdiffstats
path: root/crypto/comp
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2017-02-11 08:53:24 +0100
committerRichard Levitte <levitte@openssl.org>2017-02-24 11:22:40 +0100
commit847406923534dd791f73d0cda15d3f17f513f2a5 (patch)
treef14c3bca4d96e570d5dd4bb1061878d2b9f230e1 /crypto/comp
parentf65ee7126401eedeaaeea845bb1a258cd2fc6040 (diff)
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)
Diffstat (limited to 'crypto/comp')
-rw-r--r--crypto/comp/c_rle.c25
1 files changed, 13 insertions, 12 deletions
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);
}