summaryrefslogtreecommitdiffstats
path: root/meta/recipes-multimedia/webp/files/CVE-2023-4863-0002.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-multimedia/webp/files/CVE-2023-4863-0002.patch')
-rw-r--r--meta/recipes-multimedia/webp/files/CVE-2023-4863-0002.patch53
1 files changed, 53 insertions, 0 deletions
diff --git a/meta/recipes-multimedia/webp/files/CVE-2023-4863-0002.patch b/meta/recipes-multimedia/webp/files/CVE-2023-4863-0002.patch
new file mode 100644
index 0000000000..231894e882
--- /dev/null
+++ b/meta/recipes-multimedia/webp/files/CVE-2023-4863-0002.patch
@@ -0,0 +1,53 @@
1From 95ea5226c870449522240ccff26f0b006037c520 Mon Sep 17 00:00:00 2001
2From: Vincent Rabaud <vrabaud@google.com>
3Date: Mon, 11 Sep 2023 16:06:08 +0200
4Subject: [PATCH 2/2] Fix invalid incremental decoding check.
5
6The first condition is only necessary if we have not read enough
7(enough being defined by src_last, not src_end which is the end
8of the image).
9The second condition now fits the comment below: "if not
10incremental, and we are past the end of buffer".
11
12BUG=oss-fuzz:62136
13
14Change-Id: I0700f67c62db8e1c02c2e429a069a71e606a5e4f
15
16CVE: CVE-2023-4863
17
18Upstream-Status: Backport [https://github.com/webmproject/libwebp/commit/95ea5226c870449522240ccff26f0b006037c520]
19
20Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com>
21---
22 src/dec/vp8l_dec.c | 15 +++++++++++++--
23 1 file changed, 13 insertions(+), 2 deletions(-)
24
25diff --git a/src/dec/vp8l_dec.c b/src/dec/vp8l_dec.c
26index 186b0b2..59a9e64 100644
27--- a/src/dec/vp8l_dec.c
28+++ b/src/dec/vp8l_dec.c
29@@ -1241,9 +1241,20 @@ static int DecodeImageData(VP8LDecoder* const dec, uint32_t* const data,
30 }
31
32 br->eos_ = VP8LIsEndOfStream(br);
33- if (dec->incremental_ && br->eos_ && src < src_end) {
34+ // In incremental decoding:
35+ // br->eos_ && src < src_last: if 'br' reached the end of the buffer and
36+ // 'src_last' has not been reached yet, there is not enough data. 'dec' has to
37+ // be reset until there is more data.
38+ // !br->eos_ && src < src_last: this cannot happen as either the buffer is
39+ // fully read, either enough has been read to reach 'src_last'.
40+ // src >= src_last: 'src_last' is reached, all is fine. 'src' can actually go
41+ // beyond 'src_last' in case the image is cropped and an LZ77 goes further.
42+ // The buffer might have been enough or there is some left. 'br->eos_' does
43+ // not matter.
44+ assert(!dec->incremental_ || (br->eos_ && src < src_last) || src >= src_last);
45+ if (dec->incremental_ && br->eos_ && src < src_last) {
46 RestoreState(dec);
47- } else if (!br->eos_) {
48+ } else if ((dec->incremental_ && src >= src_last) || !br->eos_) {
49 // Process the remaining rows corresponding to last row-block.
50 if (process_func != NULL) {
51 process_func(dec, row > last_row ? last_row : row);
52--
532.40.0