Skip to contentSkip to conversation

Decompressors: Check for write errors in decompress_unlzo.c

PATCH Superseded Lasse Collin 1 participant 1 message Nov 23, 2010 Library code

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 Decompressors: Check for write errors in decompress_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.

---

lib/decompress_unlzo.c renamed from lib/decompress_unlzo.c.orig +2 -2
@@ -190,8 +190,8 @@ STATIC inline int INIT unlzo(u8 *input,
 			}
 		}
 
-		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)