diff options
| author | Peter Marko <peter.marko@siemens.com> | 2025-10-27 22:38:40 +0100 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2025-10-31 06:23:13 -0700 |
| commit | 48ab50b55cdc127d15798e806f5775b943afe633 (patch) | |
| tree | fe1d63481eb283162d90c910d1780dd809277df3 /meta | |
| parent | bee2fe9cc5d000c823869d709f9db45b4efe81c0 (diff) | |
| download | poky-48ab50b55cdc127d15798e806f5775b943afe633.tar.gz | |
lz4: patch CVE-2025-62813
Pick commit mentioned in NVD report.
(From OE-Core rev: 612d09f6b9e262640ed3ee0ee81ac4b6d7c29f4d)
Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/recipes-support/lz4/files/CVE-2025-62813.patch | 69 | ||||
| -rw-r--r-- | meta/recipes-support/lz4/lz4_1.9.4.bb | 4 |
2 files changed, 72 insertions, 1 deletions
diff --git a/meta/recipes-support/lz4/files/CVE-2025-62813.patch b/meta/recipes-support/lz4/files/CVE-2025-62813.patch new file mode 100644 index 0000000000..cb4d497d7c --- /dev/null +++ b/meta/recipes-support/lz4/files/CVE-2025-62813.patch | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | From f64efec011c058bd70348576438abac222fe6c82 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: louislafosse <louis.lafosse@epitech.eu> | ||
| 3 | Date: Mon, 31 Mar 2025 20:48:52 +0200 | ||
| 4 | Subject: [PATCH] fix(null) : improve error handlings when passing a null | ||
| 5 | pointer to some functions from lz4frame | ||
| 6 | |||
| 7 | CVE: CVE-2025-62813 | ||
| 8 | Upstream-Status: Backport [https://github.com/lz4/lz4/commit/f64efec011c058bd70348576438abac222fe6c82] | ||
| 9 | Signed-off-by: Peter Marko <peter.marko@siemens.com> | ||
| 10 | --- | ||
| 11 | lib/lz4frame.c | 15 +++++++++++++-- | ||
| 12 | tests/frametest.c | 9 ++++++--- | ||
| 13 | 2 files changed, 19 insertions(+), 5 deletions(-) | ||
| 14 | |||
| 15 | diff --git a/lib/lz4frame.c b/lib/lz4frame.c | ||
| 16 | index 85daca7b..c9e4a3cf 100644 | ||
| 17 | --- a/lib/lz4frame.c | ||
| 18 | +++ b/lib/lz4frame.c | ||
| 19 | @@ -530,9 +530,16 @@ LZ4F_CDict* | ||
| 20 | LZ4F_createCDict_advanced(LZ4F_CustomMem cmem, const void* dictBuffer, size_t dictSize) | ||
| 21 | { | ||
| 22 | const char* dictStart = (const char*)dictBuffer; | ||
| 23 | - LZ4F_CDict* const cdict = (LZ4F_CDict*)LZ4F_malloc(sizeof(*cdict), cmem); | ||
| 24 | + LZ4F_CDict* cdict = NULL; | ||
| 25 | + | ||
| 26 | DEBUGLOG(4, "LZ4F_createCDict_advanced"); | ||
| 27 | - if (!cdict) return NULL; | ||
| 28 | + | ||
| 29 | + if (!dictStart) | ||
| 30 | + return NULL; | ||
| 31 | + cdict = (LZ4F_CDict*)LZ4F_malloc(sizeof(*cdict), cmem); | ||
| 32 | + if (!cdict) | ||
| 33 | + return NULL; | ||
| 34 | + | ||
| 35 | cdict->cmem = cmem; | ||
| 36 | if (dictSize > 64 KB) { | ||
| 37 | dictStart += dictSize - 64 KB; | ||
| 38 | @@ -1429,6 +1436,10 @@ LZ4F_errorCode_t LZ4F_getFrameInfo(LZ4F_dctx* dctx, | ||
| 39 | LZ4F_frameInfo_t* frameInfoPtr, | ||
| 40 | const void* srcBuffer, size_t* srcSizePtr) | ||
| 41 | { | ||
| 42 | + assert(dctx != NULL); | ||
| 43 | + RETURN_ERROR_IF(frameInfoPtr == NULL, parameter_null); | ||
| 44 | + RETURN_ERROR_IF(srcSizePtr == NULL, parameter_null); | ||
| 45 | + | ||
| 46 | LZ4F_STATIC_ASSERT(dstage_getFrameHeader < dstage_storeFrameHeader); | ||
| 47 | if (dctx->dStage > dstage_storeFrameHeader) { | ||
| 48 | /* frameInfo already decoded */ | ||
| 49 | diff --git a/tests/frametest.c b/tests/frametest.c | ||
| 50 | index de0fe643..90247547 100644 | ||
| 51 | --- a/tests/frametest.c | ||
| 52 | +++ b/tests/frametest.c | ||
| 53 | @@ -589,10 +589,13 @@ int basicTests(U32 seed, double compressibility) | ||
| 54 | size_t const srcSize = 65 KB; /* must be > 64 KB to avoid short-size optimizations */ | ||
| 55 | size_t const dstCapacity = LZ4F_compressFrameBound(srcSize, NULL); | ||
| 56 | size_t cSizeNoDict, cSizeWithDict; | ||
| 57 | - LZ4F_CDict* const cdict = LZ4F_createCDict(CNBuffer, dictSize); | ||
| 58 | - if (cdict == NULL) goto _output_error; | ||
| 59 | - CHECK( LZ4F_createCompressionContext(&cctx, LZ4F_VERSION) ); | ||
| 60 | + LZ4F_CDict* cdict = NULL; | ||
| 61 | |||
| 62 | + CHECK( LZ4F_createCompressionContext(&cctx, LZ4F_VERSION) ); | ||
| 63 | + cdict = LZ4F_createCDict(CNBuffer, dictSize); | ||
| 64 | + if (cdict == NULL) | ||
| 65 | + goto _output_error; | ||
| 66 | + | ||
| 67 | DISPLAYLEVEL(3, "Testing LZ4F_createCDict_advanced : "); | ||
| 68 | { LZ4F_CDict* const cda = LZ4F_createCDict_advanced(lz4f_cmem_test, CNBuffer, dictSize); | ||
| 69 | if (cda == NULL) goto _output_error; | ||
diff --git a/meta/recipes-support/lz4/lz4_1.9.4.bb b/meta/recipes-support/lz4/lz4_1.9.4.bb index a2a178bab5..16bb4d0823 100644 --- a/meta/recipes-support/lz4/lz4_1.9.4.bb +++ b/meta/recipes-support/lz4/lz4_1.9.4.bb | |||
| @@ -12,7 +12,9 @@ PE = "1" | |||
| 12 | 12 | ||
| 13 | SRCREV = "5ff839680134437dbf4678f3d0c7b371d84f4964" | 13 | SRCREV = "5ff839680134437dbf4678f3d0c7b371d84f4964" |
| 14 | 14 | ||
| 15 | SRC_URI = "git://github.com/lz4/lz4.git;branch=release;protocol=https" | 15 | SRC_URI = "git://github.com/lz4/lz4.git;branch=release;protocol=https \ |
| 16 | file://CVE-2025-62813.patch \ | ||
| 17 | " | ||
| 16 | UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>.*)" | 18 | UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>.*)" |
| 17 | 19 | ||
| 18 | S = "${WORKDIR}/git" | 20 | S = "${WORKDIR}/git" |
