]> Git Repo - J-linux.git/commitdiff
jffs2: Prevent rtime decompress memory corruption
authorKinsey Moore <[email protected]>
Tue, 23 Jul 2024 20:58:05 +0000 (15:58 -0500)
committerRichard Weinberger <[email protected]>
Thu, 14 Nov 2024 19:56:19 +0000 (20:56 +0100)
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: [email protected]
Signed-off-by: Kinsey Moore <[email protected]>
Signed-off-by: Richard Weinberger <[email protected]>
fs/jffs2/compr_rtime.c

index 79e771ab624f47d7bb20323941a6a22e9c643127..2b9ef713b844afa71ab047c23a244b76c2bce6a1 100644 (file)
@@ -95,6 +95,9 @@ static int jffs2_rtime_decompress(unsigned char *data_in,
 
                positions[value]=outpos;
                if (repeat) {
+                       if ((outpos + repeat) >= destlen) {
+                               return 1;
+                       }
                        if (backoffs + repeat >= outpos) {
                                while(repeat) {
                                        cpage_out[outpos++] = cpage_out[backoffs++];
This page took 0.04543 seconds and 4 git commands to generate.