Skip to content

Commit

Permalink
Squashfs: add missing check in zlib_wrapper
Browse files Browse the repository at this point in the history
On file system corruption zlib can return Z_STREAM_OK with
input buffers remaining, which will not be released.

Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
  • Loading branch information
Phillip Lougher committed Jan 13, 2011
1 parent 170cf02 commit e7ee11f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fs/squashfs/zlib_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ static int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer,
goto release_mutex;
}

if (k < b) {
ERROR("zlib_uncompress error, data remaining\n");
goto release_mutex;
}

length = stream->total_out;
mutex_unlock(&msblk->read_data_mutex);
return length;
Expand Down

0 comments on commit e7ee11f

Please sign in to comment.