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

[Xen-devel] [PATCH 1/2] xen: always set an error return code on lz4 decompression failures



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


_______________________________________________
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®.