From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Daley Subject: [PATCH 1/2] xen: always set an error return code on lz4 decompression failures Date: Fri, 8 Nov 2013 13:26:29 +1300 Message-ID: <1383870390-9273-1-git-send-email-mattjd@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VeZuS-0004wm-FQ for xen-devel@lists.xenproject.org; Fri, 08 Nov 2013 00:26:48 +0000 Received: by mail-ie0-f171.google.com with SMTP id tp5so2247872ieb.30 for ; Thu, 07 Nov 2013 16:26:45 -0800 (PST) List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Matthew Daley , Ian Campbell , Jan Beulich List-Id: xen-devel@lists.xenproject.org Signed-off-by: Matthew Daley --- xen/common/unlz4.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xen/common/unlz4.c b/xen/common/unlz4.c index 195d829..ae87f4c 100644 --- a/xen/common/unlz4.c +++ b/xen/common/unlz4.c @@ -112,6 +112,7 @@ STATIC int INIT unlz4(unsigned char *input, unsigned int in_len, if (fill) { if (chunksize > lz4_compressbound(uncomp_chunksize)) { error("chunk length is longer than allocated"); + ret = -1; goto exit_2; } fill(inp, chunksize); @@ -133,8 +134,10 @@ STATIC int INIT unlz4(unsigned char *input, unsigned int in_len, goto exit_2; } - if (flush && flush(outp, dest_len) != dest_len) + if (flush && flush(outp, dest_len) != dest_len) { + ret = -1; goto exit_2; + } if (output) outp += dest_len; if (posp) @@ -146,6 +149,7 @@ STATIC int INIT unlz4(unsigned char *input, unsigned int in_len, break; else if (size < 0) { error("data corrupted"); + ret = -1; goto exit_2; } -- 1.7.10.4