Skip to contentSkip to conversation

Decompressors: check for write errors in unlzo.c

PATCH In review Jan Beulich 1 participant 1 message Nov 11, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 8/9 Decompressors: check for write errors in unlzo.c

From: Lasse Collin <[email protected]>

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.

xen/common/unlzo.c +2 -2
@@ -202,8 +202,8 @@ STATIC int INIT unlzo(u8 *input, unsigne
 			}
 		}
 
-		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)

Decompressors: check for write errors in unlzo.c

From: Lasse Collin <[email protected]>

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.

xen/common/unlzo.c +2 -2
@@ -202,8 +202,8 @@ STATIC int INIT unlzo(u8 *input, unsigne
 			}
 		}
 
-		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)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel