projects/linux·commit 8f9b54a3

Decompressors: check for write errors in decompress_unlzo.c

8f9b54a3 · Lasse Collin <[email protected]> · 2011-01-12 17:01:20 -08:00

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 <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Alain Knaff <[email protected]>
Cc: Albin Tonnerre <[email protected]>
Cc: Phillip Lougher <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Commit
8f9b54a35a70b604ebd2b2f2e7e04eabd0ff8a54
Parents
eb0cf3e1

Changes

1 files changed · +2 −2

FileStatusAddDelContent
lib/decompress_unlzo.cmodified+2−2View file

lib/decompress_unlzo.c

View file
diff --git a/lib/decompress_unlzo.c b/lib/decompress_unlzo.c
index 6e56d54..855d9d3 100644
--- a/lib/decompress_unlzo.c
+++ b/lib/decompress_unlzo.c
@@ -187,8 +187,8 @@ STATIC inline int INIT unlzo(u8 *input, 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)