mirror of
https://github.com/facebook/zstd.git
synced 2025-11-02 09:13:20 +03:00
Fix case where pages run out before end of stream
This commit is contained in:
@@ -101,12 +101,13 @@ static int zstd_uncompress(struct squashfs_sb_info *msblk, void *strm,
|
||||
|
||||
if (out_buf.pos == out_buf.size) {
|
||||
out_buf.dst = squashfs_next_page(output);
|
||||
out_buf.pos = 0;
|
||||
if (out_buf.dst != NULL) {
|
||||
out_buf.size = PAGE_SIZE;
|
||||
} else {
|
||||
out_buf.size = 0;
|
||||
if (out_buf.dst == NULL) {
|
||||
/* shouldn't run out of pages before stream is
|
||||
* done */
|
||||
goto out;
|
||||
}
|
||||
out_buf.pos = 0;
|
||||
out_buf.size = PAGE_SIZE;
|
||||
}
|
||||
|
||||
total_out -= out_buf.pos;
|
||||
@@ -127,7 +128,7 @@ static int zstd_uncompress(struct squashfs_sb_info *msblk, void *strm,
|
||||
if (k < b)
|
||||
goto out;
|
||||
|
||||
return total_out;
|
||||
return (int)total_out;
|
||||
|
||||
out:
|
||||
for (; k < b; k++)
|
||||
|
||||
Reference in New Issue
Block a user