Skip to content

Commit fe05155

Browse files
KinseyMoorerichardweinberger
authored andcommitted
jffs2: Prevent rtime decompress memory corruption
The rtime decompression routine does not fully check bounds during the entirety of the decompression pass and can corrupt memory outside the decompression buffer if the compressed data is corrupted. This adds the required check to prevent this failure mode. Cc: stable@vger.kernel.org Signed-off-by: Kinsey Moore <kinsey.moore@oarcorp.com> Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent 7c8e694 commit fe05155

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/jffs2/compr_rtime.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ static int jffs2_rtime_decompress(unsigned char *data_in,
9595

9696
positions[value]=outpos;
9797
if (repeat) {
98+
if ((outpos + repeat) >= destlen) {
99+
return 1;
100+
}
98101
if (backoffs + repeat >= outpos) {
99102
while(repeat) {
100103
cpage_out[outpos++] = cpage_out[backoffs++];

0 commit comments

Comments
 (0)