From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Daley Subject: [PATCH 2/2] libxc: always set a error return code on lz4 decompression failures Date: Fri, 8 Nov 2013 13:26:30 +1300 Message-ID: <1383870390-9273-2-git-send-email-mattjd@gmail.com> References: <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.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VeZuV-0004x7-6l for xen-devel@lists.xenproject.org; Fri, 08 Nov 2013 00:26:51 +0000 Received: by mail-ie0-f178.google.com with SMTP id to1so372678ieb.37 for ; Thu, 07 Nov 2013 16:26:48 -0800 (PST) In-Reply-To: <1383870390-9273-1-git-send-email-mattjd@gmail.com> 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 While at it, rename the exit_2 label to exit_1; there is no exit_1 currently. Signed-off-by: Matthew Daley --- tools/libxc/xc_dom_decompress_lz4.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/libxc/xc_dom_decompress_lz4.c b/tools/libxc/xc_dom_decompress_lz4.c index 4787535..b980186 100644 --- a/tools/libxc/xc_dom_decompress_lz4.c +++ b/tools/libxc/xc_dom_decompress_lz4.c @@ -69,13 +69,14 @@ int xc_try_lz4_decode( size -= 4; } else { msg = "invalid header"; - goto exit_2; + goto exit_1; } for (;;) { if (size < 4) { msg = "missing data"; - goto exit_2; + ret = -1; + goto exit_1; } chunksize = get_unaligned_le32(inp); if (chunksize == ARCHIVE_MAGICNUMBER) { @@ -87,7 +88,8 @@ int xc_try_lz4_decode( size -= 4; if (chunksize > size) { msg = "insufficient input data"; - goto exit_2; + ret = -1; + goto exit_1; } dest_len = out_len - (outp - output); @@ -95,7 +97,7 @@ int xc_try_lz4_decode( &dest_len); if (ret < 0) { msg = "decoding failed"; - goto exit_2; + goto exit_1; } outp += dest_len; @@ -110,13 +112,14 @@ int xc_try_lz4_decode( if (size < 0) { msg = "data corrupted"; - goto exit_2; + ret = -1; + goto exit_1; } inp += chunksize; } -exit_2: +exit_1: free(output); exit_0: DOMPRINTF("LZ4 decompression error: %s\n", msg); -- 1.7.10.4