Decompressors: check for write errors in unlzo.c
authorLasse Collin <lasse.collin@tukaani.org>
Fri, 11 Nov 2011 13:35:05 +0000 (14:35 +0100)
committerLasse Collin <lasse.collin@tukaani.org>
Fri, 11 Nov 2011 13:35:05 +0000 (14:35 +0100)
From: Lasse Collin <lasse.collin@tukaani.org>

The return value of flush() is not checked in unlzo().  This means that
the decompressor won't stop even if the caller doesn't want more data.
This can happen e.g.  with a corrupt LZO-compressed initramfs image.

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Jan Beulich <jbeulich@suse.com>
xen/common/unlzo.c

index 08117e244e0ff3818338a4d7166644db6a0273bc..f3fb098f3198155010116ca3589fcef29f7e6cf4 100644 (file)
@@ -202,8 +202,8 @@ STATIC int INIT unlzo(u8 *input, unsigned int in_len,
                        }
                }
 
-               if (flush)
-                       flush(out_buf, dst_len);
+               if (flush && flush(out_buf, dst_len) != dst_len)
+                       goto exit_2;
                if (output)
                        out_buf += dst_len;
                if (posp)