Skip to content

Commit b4c330a

Browse files
committed
fixup! u-boot: v2026.01: fix BTRFS zstd decompression failure (error 70)
add SIZE_MAX guard for 32-bit platforms
1 parent 23601bd commit b4c330a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

patch/u-boot/v2026.01/board_helios64/general-fix-btrfs-zstd-decompression.patch

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ also call their library functions directly without generic wrappers.
3636

3737
Signed-off-by: Igor Velkov <iav-armbian@draconpern.com>
3838
---
39-
fs/btrfs/compression.c | 63 ++++++++++++++++++++++++++++++++++++++++----
40-
1 file changed, 59 insertions(+), 4 deletions(-)
39+
fs/btrfs/compression.c | 65 ++++++++++++++++++++++++++++++++++++++++++----
40+
1 file changed, 61 insertions(+), 4 deletions(-)
4141

4242
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
4343
--- a/fs/btrfs/compression.c
4444
+++ b/fs/btrfs/compression.c
45-
@@ -137,12 +137,67 @@
45+
@@ -137,12 +137,69 @@
4646

4747
static u32 decompress_zstd(const u8 *cbuf, u32 clen, u8 *dbuf, u32 dlen)
4848
{
@@ -76,6 +76,8 @@ diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
7676
+ fcs = ZSTD_getFrameContentSize(cbuf, clen);
7777
+ if (fcs != ZSTD_CONTENTSIZE_ERROR &&
7878
+ fcs != ZSTD_CONTENTSIZE_UNKNOWN && fcs > dlen) {
79+
+ if (fcs > SIZE_MAX)
80+
+ return -1;
7981
+ tmp = malloc(fcs);
8082
+ if (!tmp)
8183
+ return -1;

0 commit comments

Comments
 (0)