Skip to contentSkip to conversation

libavif: patch CVE-2025-48174

PATCH In review Gyorgy Sarvari 2 participants 3 messages Oct 9, 2025 – Oct 30, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libavif: patch CVE-2025-48174

Details: https://nvd.nist.gov/vuln/detail/CVE-2025-48174

Backport the pull request mentioned in the details of the CVE.

---
 ...d-integer-overflow-check-to-makeRoom.patch | 27 +++++++++++++++++++
 .../libavif/libavif_1.0.1.bb                  |  4 ++-
 2 files changed, 30 insertions(+), 1 deletion(-)
 create mode 100644 meta-multimedia/recipes-multimedia/libavif/libavif/0001-Add-integer-overflow-check-to-makeRoom.patch
meta-multimedia/recipes-multimedia/libavif/libavif/0001-Add-integer-overflow-check-to-makeRoom.patch new file +27 -0
new file mode 100644
index 0000000000..7d16cefa49
@@ -0,0 +1,27 @@
+From 240256b05f9ff4c6d0afbcd6d4c9059037227e56 Mon Sep 17 00:00:00 2001
+From: Gyorgy Sarvari <[email protected]>
+Date: Thu, 9 Oct 2025 20:50:57 +0200
+Subject: [PATCH] Add integer overflow check to makeRoom.
+
+CVE: CVE-2025-48174
+Upstream-Status: Backport [https://github.com/AOMediaCodec/libavif/pull/2768]
+
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ src/stream.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/stream.c b/src/stream.c
+index c85ca31b..b38c93c6 100644
+--- a/src/stream.c
++++ b/src/stream.c
+@@ -319,6 +319,9 @@ avifBool avifROStreamReadAndEnforceVersion(avifROStream * stream, uint8_t enforc
+ #define AVIF_STREAM_BUFFER_INCREMENT (1024 * 1024)
+ static avifResult makeRoom(avifRWStream * stream, size_t size)
+ {
++    if (size > SIZE_MAX - stream->offset) {
++        return AVIF_RESULT_OUT_OF_MEMORY;
++    }
+     size_t neededSize = stream->offset + size;
+     size_t newSize = stream->raw->size;
+     while (newSize < neededSize) {
meta-multimedia/recipes-multimedia/libavif/libavif_1.0.1.bb +3 -1
index 885758b6a4..fa1c166eef 100644
@@ -4,7 +4,9 @@ SECTION = "libs"
 LICENSE = "BSD-2-Clause"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=c528b75b07425b5c1d2e34de98c397b5"
 
-SRC_URI = "git://github.com/AOMediaCodec/libavif.git;protocol=https;branch=v1.0.x"
+SRC_URI = "git://github.com/AOMediaCodec/libavif.git;protocol=https;branch=v1.0.x \
+           file://0001-Add-integer-overflow-check-to-makeRoom.patch \
+           "
 
 S = "${WORKDIR}/git"
 SRCREV = "d1c26facaf5a8a97919ceee06814d05d10e25622"
#1 lore raw
Quoted 32 lines · Gyorgy Sarvari via lists.openembedded.org

Details: https://nvd.nist.gov/vuln/detail/CVE-2025-48174

Backport the pull request mentioned in the details of the CVE.

---
 ...d-integer-overflow-check-to-makeRoom.patch | 27
+++++++++++++++++++
 .../libavif/libavif_1.0.1.bb                  |  4 ++-

 2 files changed, 30 insertions(+), 1 deletion(-)

 create mode 100644 meta-multimedia/recipes- multimedia/libavif/libavif/0001-Add-integer-overflow-check-to- makeRoom.patch

(quoted diff) +0 -0

Add-integer-overflow-check-to-makeRoom.patch b/meta- multimedia/recipes-multimedia/libavif/libavif/0001-Add-integer- overflow-check-to-makeRoom.patch
new file mode 100644
index 0000000000..7d16cefa49

meta-multimedia/recipes-multimedia/libavif/libavif/0001-Add- new file +0 -0

integer-overflow-check-to-makeRoom.patch

meta-multimedia/recipes-multimedia/libavif/libavif/0001-Add- new file +1 -0
@@ -0,0 +1,27 @@
+From 240256b05f9ff4c6d0afbcd6d4c9059037227e56 Mon Sep 17 00:00:00

2001

meta-multimedia/recipes-multimedia/libavif/libavif/0001-Add- new file +6 -0
+From: Gyorgy Sarvari <[email protected]>
+Date: Thu, 9 Oct 2025 20:50:57 +0200
+Subject: [PATCH] Add integer overflow check to makeRoom.
+
+CVE: CVE-2025-48174
+Upstream-Status: Backport
Quoted 1 line

[https://github.com/AOMediaCodec/libavif/pull/2768]

The PR also seems to be referencing 3 other commits that were added later on and it seems Debian also uses them:

https://salsa.debian.org/multimedia-team/libavif/-/blob/debian/sid/debian/patches/Add-another-integer-overflow-check-to-makeRoom.patch?ref_type=heads

Should we include this as well?

Quoted 56 lines
meta-multimedia/recipes-multimedia/libavif/libavif/0001-Add- new file +11 -0
+
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ src/stream.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/stream.c b/src/stream.c
+index c85ca31b..b38c93c6 100644
+--- a/src/stream.c
++++ b/src/stream.c
+@@ -319,6 +319,9 @@ avifBool

avifROStreamReadAndEnforceVersion(avifROStream * stream, uint8_t enforc
+ #define AVIF_STREAM_BUFFER_INCREMENT (1024 * 1024)
+ static avifResult makeRoom(avifRWStream * stream, size_t size)
+ {
++    if (size > SIZE_MAX - stream->offset) {
++        return AVIF_RESULT_OUT_OF_MEMORY;
++    }
+     size_t neededSize = stream->offset + size;
+     size_t newSize = stream->raw->size;
+     while (newSize < neededSize) {

(quoted diff) +0 -0

multimedia/libavif/libavif_1.0.1.bb b/meta-multimedia/recipes- multimedia/libavif/libavif_1.0.1.bb
index 885758b6a4..fa1c166eef 100644

meta-multimedia/recipes-multimedia/libavif/libavif_1.0.1.bb +0 -0
@@ -4,7 +4,9 @@ SECTION = "libs"

 LICENSE = "BSD-2-Clause"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=c528b75b07425b5c1d2e34de98c397b5"

-SRC_URI = "git://github.com/AOMediaCodec/libavif.git;protocol=https;branch=v1.0 .x"
+SRC_URI = "git://github.com/AOMediaCodec/libavif.git;protocol=https;branch=v1.0 .x \
+
file://0001-Add-integer-overflow-check-to-makeRoom.patch \
+           "

 S = "${WORKDIR}/git"
 SRCREV = "d1c26facaf5a8a97919ceee06814d05d10e25622"

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#120449):
https://lists.openembedded.org/g/openembedded-devel/message/120449
Mute This Topic: https://lists.openembedded.org/mt/115677203/3616702
Group Owner: [email protected] Unsubscribe:
https://lists.openembedded.org/g/openembedded-devel/unsub [
[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw
Quoted 38 lines · Anuj
Quoted 32 lines · Gyorgy Sarvari via lists.openembedded.org

Details: https://nvd.nist.gov/vuln/detail/CVE-2025-48174

Backport the pull request mentioned in the details of the CVE.

---
 ...d-integer-overflow-check-to-makeRoom.patch | 27
+++++++++++++++++++
 .../libavif/libavif_1.0.1.bb                  |  4 ++-

 2 files changed, 30 insertions(+), 1 deletion(-)

 create mode 100644 meta-multimedia/recipes- multimedia/libavif/libavif/0001-Add-integer-overflow-check-to- makeRoom.patch

(quoted diff) +0 -0

Add-integer-overflow-check-to-makeRoom.patch b/meta- multimedia/recipes-multimedia/libavif/libavif/0001-Add-integer- overflow-check-to-makeRoom.patch
new file mode 100644
index 0000000000..7d16cefa49

meta-multimedia/recipes-multimedia/libavif/libavif/0001-Add- new file +0 -0

integer-overflow-check-to-makeRoom.patch

meta-multimedia/recipes-multimedia/libavif/libavif/0001-Add- new file +1 -0
@@ -0,0 +1,27 @@
+From 240256b05f9ff4c6d0afbcd6d4c9059037227e56 Mon Sep 17 00:00:00

2001

meta-multimedia/recipes-multimedia/libavif/libavif/0001-Add- new file +6 -0
+From: Gyorgy Sarvari <[email protected]>
+Date: Thu, 9 Oct 2025 20:50:57 +0200
+Subject: [PATCH] Add integer overflow check to makeRoom.
+
+CVE: CVE-2025-48174
+Upstream-Status: Backport
Quoted 1 line

[https://github.com/AOMediaCodec/libavif/pull/2768]

The PR also seems to be referencing 3 other commits that were added later on and it seems Debian also uses them:

Quoted 3 lines

https://salsa.debian.org/multimedia-team/libavif/-/blob/debian/sid/debian/patches/Add-another-integer-overflow-check-to-makeRoom.patch?ref_type=heads

Should we include this as well?

Yeah, I think you are right - CVE database is such a dumpster fire... Please ignore this patch, at this time I don't have a scarthgap setup to test a followup.

Quoted 57 lines
Quoted 57 lines
meta-multimedia/recipes-multimedia/libavif/libavif/0001-Add- new file +11 -0
+
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ src/stream.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/stream.c b/src/stream.c
+index c85ca31b..b38c93c6 100644
+--- a/src/stream.c
++++ b/src/stream.c
+@@ -319,6 +319,9 @@ avifBool

avifROStreamReadAndEnforceVersion(avifROStream * stream, uint8_t enforc
+ #define AVIF_STREAM_BUFFER_INCREMENT (1024 * 1024)
+ static avifResult makeRoom(avifRWStream * stream, size_t size)
+ {
++    if (size > SIZE_MAX - stream->offset) {
++        return AVIF_RESULT_OUT_OF_MEMORY;
++    }
+     size_t neededSize = stream->offset + size;
+     size_t newSize = stream->raw->size;
+     while (newSize < neededSize) {

(quoted diff) +0 -0

multimedia/libavif/libavif_1.0.1.bb b/meta-multimedia/recipes- multimedia/libavif/libavif_1.0.1.bb
index 885758b6a4..fa1c166eef 100644

meta-multimedia/recipes-multimedia/libavif/libavif_1.0.1.bb +0 -0
@@ -4,7 +4,9 @@ SECTION = "libs"

 LICENSE = "BSD-2-Clause"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=c528b75b07425b5c1d2e34de98c397b5"

-SRC_URI = "git://github.com/AOMediaCodec/libavif.git;protocol=https;branch=v1.0 .x"
+SRC_URI = "git://github.com/AOMediaCodec/libavif.git;protocol=https;branch=v1.0 .x \
+
file://0001-Add-integer-overflow-check-to-makeRoom.patch \
+           "

 S = "${WORKDIR}/git"
 SRCREV = "d1c26facaf5a8a97919ceee06814d05d10e25622"

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#120449):
https://lists.openembedded.org/g/openembedded-devel/message/120449
Mute This Topic: https://lists.openembedded.org/mt/115677203/3616702
Group Owner: [email protected] Unsubscribe:
https://lists.openembedded.org/g/openembedded-devel/unsub [
[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-