[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 2/2] libxc: always set a error return code on lz4 decompression failures



While at it, rename the exit_2 label to exit_1; there is no exit_1
currently.

Signed-off-by: Matthew Daley <mattjd@xxxxxxxxx>
---
 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


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.