X-Git-Url: http://git.monstr.eu/?a=blobdiff_plain;f=lib%2Fdecompress_unlz4.c;h=e6327391b6b66350af40846c0c48733de04ce291;hb=4ea90317956718e0648e1f87e56530db809a5a04;hp=c0cfcfd486be00a5887b930b967c3d61b6f0a0b6;hpb=e27a24210aa17b8a0cd462865130fe73afd7e001;p=linux-2.6-microblaze.git diff --git a/lib/decompress_unlz4.c b/lib/decompress_unlz4.c index c0cfcfd486be..e6327391b6b6 100644 --- a/lib/decompress_unlz4.c +++ b/lib/decompress_unlz4.c @@ -112,6 +112,9 @@ STATIC inline int INIT unlz4(u8 *input, long in_len, error("data corrupted"); goto exit_2; } + } else if (size < 4) { + /* empty or end-of-file */ + goto exit_3; } chunksize = get_unaligned_le32(inp); @@ -125,6 +128,10 @@ STATIC inline int INIT unlz4(u8 *input, long in_len, continue; } + if (!fill && chunksize == 0) { + /* empty or end-of-file */ + goto exit_3; + } if (posp) *posp += 4; @@ -184,6 +191,7 @@ STATIC inline int INIT unlz4(u8 *input, long in_len, } } +exit_3: ret = 0; exit_2: if (!input)