diff options
| author | Alexander Kanavin <alex@linutronix.de> | 2024-12-04 07:49:09 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-12-05 17:07:10 +0000 |
| commit | bb88ab05f29011127390de8e31ef117ce42fbdc4 (patch) | |
| tree | 4d69d26449cacf711bbea09f588e905c003bd80e /meta | |
| parent | 92b8d6e559fd471d86ec3bfcf28f1a05a4a99c3f (diff) | |
| download | poky-bb88ab05f29011127390de8e31ef117ce42fbdc4.tar.gz | |
tiff: update 4.6.0 -> 4.7.0
Drop all CVE backports.
(From OE-Core rev: 1c227185c7a89df04f81c08881fd5e28aa185a21)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/recipes-multimedia/libtiff/tiff/CVE-2023-52355-0001.patch | 238 | ||||
| -rw-r--r-- | meta/recipes-multimedia/libtiff/tiff/CVE-2023-52355-0002.patch | 28 | ||||
| -rw-r--r-- | meta/recipes-multimedia/libtiff/tiff/CVE-2023-52356.patch | 49 | ||||
| -rw-r--r-- | meta/recipes-multimedia/libtiff/tiff/CVE-2023-6228.patch | 31 | ||||
| -rw-r--r-- | meta/recipes-multimedia/libtiff/tiff/CVE-2023-6277-Apply-1-suggestion-s-to-1-file-s.patch | 27 | ||||
| -rw-r--r-- | meta/recipes-multimedia/libtiff/tiff/CVE-2023-6277-At-image-reading-compare-data-size-of-some-tags-data-2.patch | 36 | ||||
| -rw-r--r-- | meta/recipes-multimedia/libtiff/tiff/CVE-2023-6277-At-image-reading-compare-data-size-of-some-tags-data.patch | 162 | ||||
| -rw-r--r-- | meta/recipes-multimedia/libtiff/tiff/CVE-2024-7006.patch | 65 | ||||
| -rw-r--r-- | meta/recipes-multimedia/libtiff/tiff_4.7.0.bb (renamed from meta/recipes-multimedia/libtiff/tiff_4.6.0.bb) | 15 |
9 files changed, 3 insertions, 648 deletions
diff --git a/meta/recipes-multimedia/libtiff/tiff/CVE-2023-52355-0001.patch b/meta/recipes-multimedia/libtiff/tiff/CVE-2023-52355-0001.patch deleted file mode 100644 index f5520fcafd..0000000000 --- a/meta/recipes-multimedia/libtiff/tiff/CVE-2023-52355-0001.patch +++ /dev/null | |||
| @@ -1,238 +0,0 @@ | |||
| 1 | From 335947359ce2dd3862cd9f7c49f92eba065dfed4 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Su_Laus <sulau@freenet.de> | ||
| 3 | Date: Thu, 1 Feb 2024 13:06:08 +0000 | ||
| 4 | Subject: [PATCH] manpage: Update TIFF documentation about TIFFOpenOptions.rst | ||
| 5 | and TIFFOpenOptionsSetMaxSingleMemAlloc() usage and some other small fixes. | ||
| 6 | |||
| 7 | CVE: CVE-2023-52355 | ||
| 8 | Upstream-Status: Backport [https://gitlab.com/libtiff/libtiff/-/commit/335947359ce2dd3862cd9f7c49f92eba065dfed4] | ||
| 9 | |||
| 10 | Signed-off-by: Yogita Urade <yogita.urade@windriver.com> | ||
| 11 | --- | ||
| 12 | doc/functions/TIFFDeferStrileArrayWriting.rst | 5 +++ | ||
| 13 | doc/functions/TIFFError.rst | 3 ++ | ||
| 14 | doc/functions/TIFFOpen.rst | 13 +++--- | ||
| 15 | doc/functions/TIFFOpenOptions.rst | 44 ++++++++++++++++++- | ||
| 16 | doc/functions/TIFFStrileQuery.rst | 5 +++ | ||
| 17 | doc/libtiff.rst | 31 ++++++++++++- | ||
| 18 | 6 files changed, 91 insertions(+), 10 deletions(-) | ||
| 19 | |||
| 20 | diff --git a/doc/functions/TIFFDeferStrileArrayWriting.rst b/doc/functions/TIFFDeferStrileArrayWriting.rst | ||
| 21 | index 60ee746..705aebc 100644 | ||
| 22 | --- a/doc/functions/TIFFDeferStrileArrayWriting.rst | ||
| 23 | +++ b/doc/functions/TIFFDeferStrileArrayWriting.rst | ||
| 24 | @@ -61,6 +61,11 @@ Diagnostics | ||
| 25 | All error messages are directed to the :c:func:`TIFFErrorExtR` routine. | ||
| 26 | Likewise, warning messages are directed to the :c:func:`TIFFWarningExtR` routine. | ||
| 27 | |||
| 28 | +Note | ||
| 29 | +---- | ||
| 30 | + | ||
| 31 | +This functionality was introduced with libtiff 4.1. | ||
| 32 | + | ||
| 33 | See also | ||
| 34 | -------- | ||
| 35 | |||
| 36 | diff --git a/doc/functions/TIFFError.rst b/doc/functions/TIFFError.rst | ||
| 37 | index 99924ad..cf4b37c 100644 | ||
| 38 | --- a/doc/functions/TIFFError.rst | ||
| 39 | +++ b/doc/functions/TIFFError.rst | ||
| 40 | @@ -65,6 +65,9 @@ or :c:func:`TIFFClientOpenExt`. | ||
| 41 | Furthermore, a **custom defined data structure** *user_data* for the | ||
| 42 | error handler can be given along. | ||
| 43 | |||
| 44 | +Please refer to :doc:`/functions/TIFFOpenOptions` for how to setup the | ||
| 45 | +application-specific handler introduced with libtiff 4.5. | ||
| 46 | + | ||
| 47 | Note | ||
| 48 | ---- | ||
| 49 | |||
| 50 | diff --git a/doc/functions/TIFFOpen.rst b/doc/functions/TIFFOpen.rst | ||
| 51 | index db79d7b..adc474f 100644 | ||
| 52 | --- a/doc/functions/TIFFOpen.rst | ||
| 53 | +++ b/doc/functions/TIFFOpen.rst | ||
| 54 | @@ -94,8 +94,9 @@ TIFF structure without closing the file handle and afterwards the | ||
| 55 | file should be closed using its file descriptor *fd*. | ||
| 56 | |||
| 57 | :c:func:`TIFFOpenExt` (added in libtiff 4.5) is like :c:func:`TIFFOpen`, | ||
| 58 | -but options, such as re-entrant error and warning handlers may be passed | ||
| 59 | -with the *opts* argument. The *opts* argument may be NULL. | ||
| 60 | +but options, such as re-entrant error and warning handlers and a limit in byte | ||
| 61 | +that libtiff internal memory allocation functions are allowed to request per call | ||
| 62 | +may be passed with the *opts* argument. The *opts* argument may be NULL. | ||
| 63 | Refer to :doc:`TIFFOpenOptions` for allocating and filling the *opts* argument | ||
| 64 | parameters. The allocated memory for :c:type:`TIFFOpenOptions` | ||
| 65 | can be released straight after successful execution of the related | ||
| 66 | @@ -105,9 +106,7 @@ can be released straight after successful execution of the related | ||
| 67 | but opens a TIFF file with a Unicode filename. | ||
| 68 | |||
| 69 | :c:func:`TIFFFdOpenExt` (added in libtiff 4.5) is like :c:func:`TIFFFdOpen`, | ||
| 70 | -but options, such as re-entrant error and warning handlers may be passed | ||
| 71 | -with the *opts* argument. The *opts* argument may be NULL. | ||
| 72 | -Refer to :doc:`TIFFOpenOptions` for filling the *opts* argument. | ||
| 73 | +but options argument *opts* like for :c:func:`TIFFOpenExt` can be passed. | ||
| 74 | |||
| 75 | :c:func:`TIFFSetFileName` sets the file name in the tif-structure | ||
| 76 | and returns the old file name. | ||
| 77 | @@ -326,5 +325,5 @@ See also | ||
| 78 | |||
| 79 | :doc:`libtiff` (3tiff), | ||
| 80 | :doc:`TIFFClose` (3tiff), | ||
| 81 | -:doc:`TIFFStrileQuery`, | ||
| 82 | -:doc:`TIFFOpenOptions` | ||
| 83 | \ No newline at end of file | ||
| 84 | +:doc:`TIFFStrileQuery` (3tiff), | ||
| 85 | +:doc:`TIFFOpenOptions` | ||
| 86 | diff --git a/doc/functions/TIFFOpenOptions.rst b/doc/functions/TIFFOpenOptions.rst | ||
| 87 | index 5c67566..23f2975 100644 | ||
| 88 | --- a/doc/functions/TIFFOpenOptions.rst | ||
| 89 | +++ b/doc/functions/TIFFOpenOptions.rst | ||
| 90 | @@ -38,12 +38,17 @@ opaque structure and returns a :c:type:`TIFFOpenOptions` pointer. | ||
| 91 | :c:func:`TIFFOpenOptionsFree` releases the allocated memory for | ||
| 92 | :c:type:`TIFFOpenOptions`. The allocated memory for :c:type:`TIFFOpenOptions` | ||
| 93 | can be released straight after successful execution of the related | ||
| 94 | -TIFF open"Ext" functions like :c:func:`TIFFOpenExt`. | ||
| 95 | +TIFFOpen"Ext" functions like :c:func:`TIFFOpenExt`. | ||
| 96 | |||
| 97 | :c:func:`TIFFOpenOptionsSetMaxSingleMemAlloc` sets parameter for the | ||
| 98 | maximum single memory limit in byte that ``libtiff`` internal memory allocation | ||
| 99 | functions are allowed to request per call. | ||
| 100 | |||
| 101 | +.. note:: | ||
| 102 | + However, the ``libtiff`` external functions :c:func:`_TIFFmalloc` | ||
| 103 | + and :c:func:`_TIFFrealloc` **do not apply** this internal memory | ||
| 104 | + allocation limit set by :c:func:`TIFFOpenOptionsSetMaxSingleMemAlloc`! | ||
| 105 | + | ||
| 106 | :c:func:`TIFFOpenOptionsSetErrorHandlerExtR` sets the function pointer to | ||
| 107 | an application-specific and per-TIFF handle (re-entrant) error handler. | ||
| 108 | Furthermore, a pointer to a **custom defined data structure** *errorhandler_user_data* | ||
| 109 | @@ -55,6 +60,43 @@ The *errorhandler_user_data* argument may be NULL. | ||
| 110 | :c:func:`TIFFOpenOptionsSetErrorHandlerExtR` but for the warning handler, | ||
| 111 | which is invoked through :c:func:`TIFFWarningExtR` | ||
| 112 | |||
| 113 | +Example | ||
| 114 | +------- | ||
| 115 | + | ||
| 116 | +:: | ||
| 117 | + | ||
| 118 | + #include "tiffio.h" | ||
| 119 | + | ||
| 120 | + typedef struct MyErrorHandlerUserDataStruct | ||
| 121 | + { | ||
| 122 | + /* ... any user data structure ... */ | ||
| 123 | + } MyErrorHandlerUserDataStruct; | ||
| 124 | + | ||
| 125 | + static int myErrorHandler(TIFF *tiff, void *user_data, const char *module, | ||
| 126 | + const char *fmt, va_list ap) | ||
| 127 | + { | ||
| 128 | + MyErrorHandlerUserDataStruct *errorhandler_user_data = | ||
| 129 | + (MyErrorHandlerUserDataStruct *)user_data; | ||
| 130 | + /*... code of myErrorHandler ...*/ | ||
| 131 | + return 1; | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + | ||
| 135 | + main() | ||
| 136 | + { | ||
| 137 | + tmsize_t limit = (256 * 1024 * 1024); | ||
| 138 | + MyErrorHandlerUserDataStruct user_data = { /* ... any data ... */}; | ||
| 139 | + | ||
| 140 | + TIFFOpenOptions *opts = TIFFOpenOptionsAlloc(); | ||
| 141 | + TIFFOpenOptionsSetMaxSingleMemAlloc(opts, limit); | ||
| 142 | + TIFFOpenOptionsSetErrorHandlerExtR(opts, myErrorHandler, &user_data); | ||
| 143 | + TIFF *tif = TIFFOpenExt("foo.tif", "r", opts); | ||
| 144 | + TIFFOpenOptionsFree(opts); | ||
| 145 | + /* ... go on here ... */ | ||
| 146 | + | ||
| 147 | + TIFFClose(tif); | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | Note | ||
| 151 | ---- | ||
| 152 | |||
| 153 | diff --git a/doc/functions/TIFFStrileQuery.rst b/doc/functions/TIFFStrileQuery.rst | ||
| 154 | index f8631af..7931fe4 100644 | ||
| 155 | --- a/doc/functions/TIFFStrileQuery.rst | ||
| 156 | +++ b/doc/functions/TIFFStrileQuery.rst | ||
| 157 | @@ -66,6 +66,11 @@ Diagnostics | ||
| 158 | All error messages are directed to the :c:func:`TIFFErrorExtR` routine. | ||
| 159 | Likewise, warning messages are directed to the :c:func:`TIFFWarningExtR` routine. | ||
| 160 | |||
| 161 | +Note | ||
| 162 | +---- | ||
| 163 | + | ||
| 164 | +This functionality was introduced with libtiff 4.1. | ||
| 165 | + | ||
| 166 | See also | ||
| 167 | -------- | ||
| 168 | |||
| 169 | diff --git a/doc/libtiff.rst b/doc/libtiff.rst | ||
| 170 | index 6a0054c..d96a860 100644 | ||
| 171 | --- a/doc/libtiff.rst | ||
| 172 | +++ b/doc/libtiff.rst | ||
| 173 | @@ -90,11 +90,15 @@ compatibility on machines with a segmented architecture. | ||
| 174 | :c:func:`realloc`, and :c:func:`free` routines in the C library.) | ||
| 175 | |||
| 176 | To deal with segmented pointer issues ``libtiff`` also provides | ||
| 177 | -:c:func:`_TIFFmemcpy`, :c:func:`_TIFFmemset`, and :c:func:`_TIFFmemmove` | ||
| 178 | +:c:func:`_TIFFmemcpy`, :c:func:`_TIFFmemset`, and :c:func:`_TIFFmemcmp` | ||
| 179 | routines that mimic the equivalent ANSI C routines, but that are | ||
| 180 | intended for use with memory allocated through :c:func:`_TIFFmalloc` | ||
| 181 | and :c:func:`_TIFFrealloc`. | ||
| 182 | |||
| 183 | +With ``libtiff`` 4.5 a method was introduced to limit the internal | ||
| 184 | +memory allocation that functions are allowed to request per call | ||
| 185 | +(see :c:func:`TIFFOpenOptionsSetMaxSingleMemAlloc` and :c:func:`TIFFOpenExt`). | ||
| 186 | + | ||
| 187 | Error Handling | ||
| 188 | -------------- | ||
| 189 | |||
| 190 | @@ -106,6 +110,10 @@ routine that can be specified with a call to :c:func:`TIFFSetErrorHandler`. | ||
| 191 | Likewise warning messages are directed to a single handler routine | ||
| 192 | that can be specified with a call to :c:func:`TIFFSetWarningHandler` | ||
| 193 | |||
| 194 | +Further application-specific and per-TIFF handle (re-entrant) error handler | ||
| 195 | +and warning handler can be set. Please refer to :doc:`/functions/TIFFError` | ||
| 196 | +and :doc:`/functions/TIFFOpenOptions`. | ||
| 197 | + | ||
| 198 | Basic File Handling | ||
| 199 | ------------------- | ||
| 200 | |||
| 201 | @@ -139,7 +147,7 @@ a ``"w"`` argument: | ||
| 202 | main() | ||
| 203 | { | ||
| 204 | TIFF* tif = TIFFOpen("foo.tif", "w"); | ||
| 205 | - ... do stuff ... | ||
| 206 | + /* ... do stuff ... */ | ||
| 207 | TIFFClose(tif); | ||
| 208 | } | ||
| 209 | |||
| 210 | @@ -157,6 +165,25 @@ to always call :c:func:`TIFFClose` or :c:func:`TIFFFlush` to flush any | ||
| 211 | buffered information to a file. Note that if you call :c:func:`TIFFClose` | ||
| 212 | you do not need to call :c:func:`TIFFFlush`. | ||
| 213 | |||
| 214 | +.. warning:: | ||
| 215 | + | ||
| 216 | + In order to prevent out-of-memory issues when opening a TIFF file | ||
| 217 | + :c:func:`TIFFOpenExt` can be used and then the maximum single memory | ||
| 218 | + limit in byte that ``libtiff`` internal memory allocation functions | ||
| 219 | + are allowed to request per call can be set with | ||
| 220 | + :c:func:`TIFFOpenOptionsSetMaxSingleMemAlloc`. | ||
| 221 | + | ||
| 222 | +Example | ||
| 223 | + | ||
| 224 | +:: | ||
| 225 | + | ||
| 226 | + tmsize_t limit = (256 * 1024 * 1024); | ||
| 227 | + TIFFOpenOptions *opts = TIFFOpenOptionsAlloc(); | ||
| 228 | + TIFFOpenOptionsSetMaxSingleMemAlloc(opts, limit); | ||
| 229 | + TIFF *tif = TIFFOpenExt("foo.tif", "w", opts); | ||
| 230 | + TIFFOpenOptionsFree(opts); | ||
| 231 | + /* ... go on here ... */ | ||
| 232 | + | ||
| 233 | TIFF Directories | ||
| 234 | ---------------- | ||
| 235 | |||
| 236 | -- | ||
| 237 | 2.40.0 | ||
| 238 | |||
diff --git a/meta/recipes-multimedia/libtiff/tiff/CVE-2023-52355-0002.patch b/meta/recipes-multimedia/libtiff/tiff/CVE-2023-52355-0002.patch deleted file mode 100644 index 19a1ef727a..0000000000 --- a/meta/recipes-multimedia/libtiff/tiff/CVE-2023-52355-0002.patch +++ /dev/null | |||
| @@ -1,28 +0,0 @@ | |||
| 1 | From 16ab4a205cfc938c32686e8d697d048fabf97ed4 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Timothy Lyanguzov <theta682@gmail.com> | ||
| 3 | Date: Thu, 1 Feb 2024 11:19:06 +0000 | ||
| 4 | Subject: [PATCH] Fix typo. | ||
| 5 | |||
| 6 | CVE: CVE-2023-52355 | ||
| 7 | Upstream-Status: Backport [https://gitlab.com/libtiff/libtiff/-/commit/16ab4a205cfc938c32686e8d697d048fabf97ed4] | ||
| 8 | |||
| 9 | Signed-off-by: Yogita Urade <yogita.urade@windriver.com> | ||
| 10 | --- | ||
| 11 | doc/libtiff.rst | 2 +- | ||
| 12 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 13 | |||
| 14 | diff --git a/doc/libtiff.rst b/doc/libtiff.rst | ||
| 15 | index d96a860..4fedc3e 100644 | ||
| 16 | --- a/doc/libtiff.rst | ||
| 17 | +++ b/doc/libtiff.rst | ||
| 18 | @@ -169,7 +169,7 @@ you do not need to call :c:func:`TIFFFlush`. | ||
| 19 | |||
| 20 | In order to prevent out-of-memory issues when opening a TIFF file | ||
| 21 | :c:func:`TIFFOpenExt` can be used and then the maximum single memory | ||
| 22 | - limit in byte that ``libtiff`` internal memory allocation functions | ||
| 23 | + limit in bytes that ``libtiff`` internal memory allocation functions | ||
| 24 | are allowed to request per call can be set with | ||
| 25 | :c:func:`TIFFOpenOptionsSetMaxSingleMemAlloc`. | ||
| 26 | |||
| 27 | -- | ||
| 28 | 2.40.0 | ||
diff --git a/meta/recipes-multimedia/libtiff/tiff/CVE-2023-52356.patch b/meta/recipes-multimedia/libtiff/tiff/CVE-2023-52356.patch deleted file mode 100644 index 75f5d8946a..0000000000 --- a/meta/recipes-multimedia/libtiff/tiff/CVE-2023-52356.patch +++ /dev/null | |||
| @@ -1,49 +0,0 @@ | |||
| 1 | From 51558511bdbbcffdce534db21dbaf5d54b31638a Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Even Rouault <even.rouault@spatialys.com> | ||
| 3 | Date: Thu, 1 Feb 2024 11:38:14 +0000 | ||
| 4 | Subject: [PATCH] TIFFReadRGBAStrip/TIFFReadRGBATile: add more validation of | ||
| 5 | col/row (fixes #622) | ||
| 6 | |||
| 7 | CVE: CVE-2023-52356 | ||
| 8 | Upstream-Status: Backport [https://gitlab.com/libtiff/libtiff/-/commit/51558511bdbbcffdce534db21dbaf5d54b31638a] | ||
| 9 | |||
| 10 | Signed-off-by: Yogita Urade <yogita.urade@windriver.com> | ||
| 11 | --- | ||
| 12 | libtiff/tif_getimage.c | 15 +++++++++++++++ | ||
| 13 | 1 file changed, 15 insertions(+) | ||
| 14 | |||
| 15 | diff --git a/libtiff/tif_getimage.c b/libtiff/tif_getimage.c | ||
| 16 | index 41f7dfd..9cd6eee 100644 | ||
| 17 | --- a/libtiff/tif_getimage.c | ||
| 18 | +++ b/libtiff/tif_getimage.c | ||
| 19 | @@ -3224,6 +3224,13 @@ int TIFFReadRGBAStripExt(TIFF *tif, uint32_t row, uint32_t *raster, | ||
| 20 | if (TIFFRGBAImageOK(tif, emsg) && | ||
| 21 | TIFFRGBAImageBegin(&img, tif, stop_on_error, emsg)) | ||
| 22 | { | ||
| 23 | + if (row >= img.height) | ||
| 24 | + { | ||
| 25 | + TIFFErrorExtR(tif, TIFFFileName(tif), | ||
| 26 | + "Invalid row passed to TIFFReadRGBAStrip()."); | ||
| 27 | + TIFFRGBAImageEnd(&img); | ||
| 28 | + return (0); | ||
| 29 | + } | ||
| 30 | |||
| 31 | img.row_offset = row; | ||
| 32 | img.col_offset = 0; | ||
| 33 | @@ -3301,6 +3308,14 @@ int TIFFReadRGBATileExt(TIFF *tif, uint32_t col, uint32_t row, uint32_t *raster, | ||
| 34 | return (0); | ||
| 35 | } | ||
| 36 | |||
| 37 | + if (col >= img.width || row >= img.height) | ||
| 38 | + { | ||
| 39 | + TIFFErrorExtR(tif, TIFFFileName(tif), | ||
| 40 | + "Invalid row/col passed to TIFFReadRGBATile()."); | ||
| 41 | + TIFFRGBAImageEnd(&img); | ||
| 42 | + return (0); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | /* | ||
| 46 | * The TIFFRGBAImageGet() function doesn't allow us to get off the | ||
| 47 | * edge of the image, even to fill an otherwise valid tile. So we | ||
| 48 | -- | ||
| 49 | 2.40.0 | ||
diff --git a/meta/recipes-multimedia/libtiff/tiff/CVE-2023-6228.patch b/meta/recipes-multimedia/libtiff/tiff/CVE-2023-6228.patch deleted file mode 100644 index 2020508fdf..0000000000 --- a/meta/recipes-multimedia/libtiff/tiff/CVE-2023-6228.patch +++ /dev/null | |||
| @@ -1,31 +0,0 @@ | |||
| 1 | From 1e7d217a323eac701b134afc4ae39b6bdfdbc96a Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Su_Laus <sulau@freenet.de> | ||
| 3 | Date: Wed, 17 Jan 2024 06:57:08 +0000 | ||
| 4 | Subject: [PATCH] codec of input image is available, independently from codec | ||
| 5 | check of output image and return with error if not. | ||
| 6 | |||
| 7 | Fixes #606. | ||
| 8 | |||
| 9 | CVE: CVE-2023-6228 | ||
| 10 | Upstream-Status: Backport [https://gitlab.com/libtiff/libtiff/-/commit/1e7d217a323eac701b134afc4ae39b6bdfdbc96a] | ||
| 11 | |||
| 12 | Signed-off-by: Yogita Urade <yogita.urade@windriver.com> | ||
| 13 | --- | ||
| 14 | tools/tiffcp.c | 2 ++ | ||
| 15 | 1 file changed, 2 insertions(+) | ||
| 16 | |||
| 17 | diff --git a/tools/tiffcp.c b/tools/tiffcp.c | ||
| 18 | index aff0626..a4f7f6b 100644 | ||
| 19 | --- a/tools/tiffcp.c | ||
| 20 | +++ b/tools/tiffcp.c | ||
| 21 | @@ -846,6 +846,8 @@ static int tiffcp(TIFF *in, TIFF *out) | ||
| 22 | if (!TIFFIsCODECConfigured(compression)) | ||
| 23 | return FALSE; | ||
| 24 | TIFFGetFieldDefaulted(in, TIFFTAG_COMPRESSION, &input_compression); | ||
| 25 | + if (!TIFFIsCODECConfigured(input_compression)) | ||
| 26 | + return FALSE; | ||
| 27 | TIFFGetFieldDefaulted(in, TIFFTAG_PHOTOMETRIC, &input_photometric); | ||
| 28 | if (input_compression == COMPRESSION_JPEG) | ||
| 29 | { | ||
| 30 | -- | ||
| 31 | 2.40.0 | ||
diff --git a/meta/recipes-multimedia/libtiff/tiff/CVE-2023-6277-Apply-1-suggestion-s-to-1-file-s.patch b/meta/recipes-multimedia/libtiff/tiff/CVE-2023-6277-Apply-1-suggestion-s-to-1-file-s.patch deleted file mode 100644 index 5d15dff1d9..0000000000 --- a/meta/recipes-multimedia/libtiff/tiff/CVE-2023-6277-Apply-1-suggestion-s-to-1-file-s.patch +++ /dev/null | |||
| @@ -1,27 +0,0 @@ | |||
| 1 | From e1640519208121f916da1772a5efb6ca28971b86 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Even Rouault <even.rouault@spatialys.com> | ||
| 3 | Date: Tue, 31 Oct 2023 15:04:37 +0000 | ||
| 4 | Subject: [PATCH 3/3] Apply 1 suggestion(s) to 1 file(s) | ||
| 5 | |||
| 6 | CVE: CVE-2023-6277 | ||
| 7 | Upstream-Status: Backport [https://gitlab.com/libtiff/libtiff/-/merge_requests/545] | ||
| 8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 9 | --- | ||
| 10 | libtiff/tif_dirread.c | 1 - | ||
| 11 | 1 file changed, 1 deletion(-) | ||
| 12 | |||
| 13 | diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c | ||
| 14 | index fe8d6f8..58a4276 100644 | ||
| 15 | --- a/libtiff/tif_dirread.c | ||
| 16 | +++ b/libtiff/tif_dirread.c | ||
| 17 | @@ -5306,7 +5306,6 @@ static int EstimateStripByteCounts(TIFF *tif, TIFFDirEntry *dir, | ||
| 18 | { | ||
| 19 | uint64_t space; | ||
| 20 | uint16_t n; | ||
| 21 | - filesize = TIFFGetFileSize(tif); | ||
| 22 | if (!(tif->tif_flags & TIFF_BIGTIFF)) | ||
| 23 | space = sizeof(TIFFHeaderClassic) + 2 + dircount * 12 + 4; | ||
| 24 | else | ||
| 25 | -- | ||
| 26 | 2.43.0 | ||
| 27 | |||
diff --git a/meta/recipes-multimedia/libtiff/tiff/CVE-2023-6277-At-image-reading-compare-data-size-of-some-tags-data-2.patch b/meta/recipes-multimedia/libtiff/tiff/CVE-2023-6277-At-image-reading-compare-data-size-of-some-tags-data-2.patch deleted file mode 100644 index 9fc8182fef..0000000000 --- a/meta/recipes-multimedia/libtiff/tiff/CVE-2023-6277-At-image-reading-compare-data-size-of-some-tags-data-2.patch +++ /dev/null | |||
| @@ -1,36 +0,0 @@ | |||
| 1 | From f500facf7723f1cae725dd288b2daad15e45131c Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Su_Laus <sulau@freenet.de> | ||
| 3 | Date: Mon, 30 Oct 2023 21:21:57 +0100 | ||
| 4 | Subject: [PATCH 2/3] At image reading, compare data size of some tags / data | ||
| 5 | structures (StripByteCounts, StripOffsets, StripArray, TIFF directory) with | ||
| 6 | file size to prevent provoked out-of-memory attacks. | ||
| 7 | MIME-Version: 1.0 | ||
| 8 | Content-Type: text/plain; charset=UTF-8 | ||
| 9 | Content-Transfer-Encoding: 8bit | ||
| 10 | |||
| 11 | See issue #614. | ||
| 12 | |||
| 13 | Correct declaration of ‘filesize’ shadows a previous local. | ||
| 14 | |||
| 15 | CVE: CVE-2023-6277 | ||
| 16 | Upstream-Status: Backport [https://gitlab.com/libtiff/libtiff/-/merge_requests/545] | ||
| 17 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 18 | --- | ||
| 19 | libtiff/tif_dirread.c | 1 - | ||
| 20 | 1 file changed, 1 deletion(-) | ||
| 21 | |||
| 22 | diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c | ||
| 23 | index c52d41f..fe8d6f8 100644 | ||
| 24 | --- a/libtiff/tif_dirread.c | ||
| 25 | +++ b/libtiff/tif_dirread.c | ||
| 26 | @@ -5305,7 +5305,6 @@ static int EstimateStripByteCounts(TIFF *tif, TIFFDirEntry *dir, | ||
| 27 | if (td->td_compression != COMPRESSION_NONE) | ||
| 28 | { | ||
| 29 | uint64_t space; | ||
| 30 | - uint64_t filesize; | ||
| 31 | uint16_t n; | ||
| 32 | filesize = TIFFGetFileSize(tif); | ||
| 33 | if (!(tif->tif_flags & TIFF_BIGTIFF)) | ||
| 34 | -- | ||
| 35 | 2.43.0 | ||
| 36 | |||
diff --git a/meta/recipes-multimedia/libtiff/tiff/CVE-2023-6277-At-image-reading-compare-data-size-of-some-tags-data.patch b/meta/recipes-multimedia/libtiff/tiff/CVE-2023-6277-At-image-reading-compare-data-size-of-some-tags-data.patch deleted file mode 100644 index d5854a9059..0000000000 --- a/meta/recipes-multimedia/libtiff/tiff/CVE-2023-6277-At-image-reading-compare-data-size-of-some-tags-data.patch +++ /dev/null | |||
| @@ -1,162 +0,0 @@ | |||
| 1 | From b33baa5d9c6aac8ce49b5180dd48e39697ab7a11 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Su_Laus <sulau@freenet.de> | ||
| 3 | Date: Fri, 27 Oct 2023 22:11:10 +0200 | ||
| 4 | Subject: [PATCH 1/3] At image reading, compare data size of some tags / data | ||
| 5 | structures (StripByteCounts, StripOffsets, StripArray, TIFF directory) with | ||
| 6 | file size to prevent provoked out-of-memory attacks. | ||
| 7 | |||
| 8 | See issue #614. | ||
| 9 | |||
| 10 | CVE: CVE-2023-6277 | ||
| 11 | Upstream-Status: Backport [https://gitlab.com/libtiff/libtiff/-/merge_requests/545] | ||
| 12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 13 | --- | ||
| 14 | libtiff/tif_dirread.c | 90 +++++++++++++++++++++++++++++++++++++++++++ | ||
| 15 | 1 file changed, 90 insertions(+) | ||
| 16 | |||
| 17 | diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c | ||
| 18 | index 2c49dc6..c52d41f 100644 | ||
| 19 | --- a/libtiff/tif_dirread.c | ||
| 20 | +++ b/libtiff/tif_dirread.c | ||
| 21 | @@ -1308,6 +1308,21 @@ TIFFReadDirEntryArrayWithLimit(TIFF *tif, TIFFDirEntry *direntry, | ||
| 22 | datasize = (*count) * typesize; | ||
| 23 | assert((tmsize_t)datasize > 0); | ||
| 24 | |||
| 25 | + /* Before allocating a huge amount of memory for corrupted files, check if | ||
| 26 | + * size of requested memory is not greater than file size. | ||
| 27 | + */ | ||
| 28 | + uint64_t filesize = TIFFGetFileSize(tif); | ||
| 29 | + if (datasize > filesize) | ||
| 30 | + { | ||
| 31 | + TIFFWarningExtR(tif, "ReadDirEntryArray", | ||
| 32 | + "Requested memory size for tag %d (0x%x) %" PRIu32 | ||
| 33 | + " is greather than filesize %" PRIu64 | ||
| 34 | + ". Memory not allocated, tag not read", | ||
| 35 | + direntry->tdir_tag, direntry->tdir_tag, datasize, | ||
| 36 | + filesize); | ||
| 37 | + return (TIFFReadDirEntryErrAlloc); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | if (isMapped(tif) && datasize > (uint64_t)tif->tif_size) | ||
| 41 | return TIFFReadDirEntryErrIo; | ||
| 42 | |||
| 43 | @@ -5266,6 +5281,20 @@ static int EstimateStripByteCounts(TIFF *tif, TIFFDirEntry *dir, | ||
| 44 | if (!_TIFFFillStrilesInternal(tif, 0)) | ||
| 45 | return -1; | ||
| 46 | |||
| 47 | + /* Before allocating a huge amount of memory for corrupted files, check if | ||
| 48 | + * size of requested memory is not greater than file size. */ | ||
| 49 | + uint64_t filesize = TIFFGetFileSize(tif); | ||
| 50 | + uint64_t allocsize = (uint64_t)td->td_nstrips * sizeof(uint64_t); | ||
| 51 | + if (allocsize > filesize) | ||
| 52 | + { | ||
| 53 | + TIFFWarningExtR(tif, module, | ||
| 54 | + "Requested memory size for StripByteCounts of %" PRIu64 | ||
| 55 | + " is greather than filesize %" PRIu64 | ||
| 56 | + ". Memory not allocated", | ||
| 57 | + allocsize, filesize); | ||
| 58 | + return -1; | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | if (td->td_stripbytecount_p) | ||
| 62 | _TIFFfreeExt(tif, td->td_stripbytecount_p); | ||
| 63 | td->td_stripbytecount_p = (uint64_t *)_TIFFCheckMalloc( | ||
| 64 | @@ -5807,6 +5836,20 @@ static uint16_t TIFFFetchDirectory(TIFF *tif, uint64_t diroff, | ||
| 65 | dircount16 = (uint16_t)dircount64; | ||
| 66 | dirsize = 20; | ||
| 67 | } | ||
| 68 | + /* Before allocating a huge amount of memory for corrupted files, check | ||
| 69 | + * if size of requested memory is not greater than file size. */ | ||
| 70 | + uint64_t filesize = TIFFGetFileSize(tif); | ||
| 71 | + uint64_t allocsize = (uint64_t)dircount16 * dirsize; | ||
| 72 | + if (allocsize > filesize) | ||
| 73 | + { | ||
| 74 | + TIFFWarningExtR( | ||
| 75 | + tif, module, | ||
| 76 | + "Requested memory size for TIFF directory of %" PRIu64 | ||
| 77 | + " is greather than filesize %" PRIu64 | ||
| 78 | + ". Memory not allocated, TIFF directory not read", | ||
| 79 | + allocsize, filesize); | ||
| 80 | + return 0; | ||
| 81 | + } | ||
| 82 | origdir = _TIFFCheckMalloc(tif, dircount16, dirsize, | ||
| 83 | "to read TIFF directory"); | ||
| 84 | if (origdir == NULL) | ||
| 85 | @@ -5921,6 +5964,20 @@ static uint16_t TIFFFetchDirectory(TIFF *tif, uint64_t diroff, | ||
| 86 | "directories not supported"); | ||
| 87 | return 0; | ||
| 88 | } | ||
| 89 | + /* Before allocating a huge amount of memory for corrupted files, check | ||
| 90 | + * if size of requested memory is not greater than file size. */ | ||
| 91 | + uint64_t filesize = TIFFGetFileSize(tif); | ||
| 92 | + uint64_t allocsize = (uint64_t)dircount16 * dirsize; | ||
| 93 | + if (allocsize > filesize) | ||
| 94 | + { | ||
| 95 | + TIFFWarningExtR( | ||
| 96 | + tif, module, | ||
| 97 | + "Requested memory size for TIFF directory of %" PRIu64 | ||
| 98 | + " is greather than filesize %" PRIu64 | ||
| 99 | + ". Memory not allocated, TIFF directory not read", | ||
| 100 | + allocsize, filesize); | ||
| 101 | + return 0; | ||
| 102 | + } | ||
| 103 | origdir = _TIFFCheckMalloc(tif, dircount16, dirsize, | ||
| 104 | "to read TIFF directory"); | ||
| 105 | if (origdir == NULL) | ||
| 106 | @@ -5968,6 +6025,8 @@ static uint16_t TIFFFetchDirectory(TIFF *tif, uint64_t diroff, | ||
| 107 | } | ||
| 108 | } | ||
| 109 | } | ||
| 110 | + /* No check against filesize needed here because "dir" should have same size | ||
| 111 | + * than "origdir" checked above. */ | ||
| 112 | dir = (TIFFDirEntry *)_TIFFCheckMalloc( | ||
| 113 | tif, dircount16, sizeof(TIFFDirEntry), "to read TIFF directory"); | ||
| 114 | if (dir == 0) | ||
| 115 | @@ -7164,6 +7223,20 @@ static int TIFFFetchStripThing(TIFF *tif, TIFFDirEntry *dir, uint32_t nstrips, | ||
| 116 | return (0); | ||
| 117 | } | ||
| 118 | |||
| 119 | + /* Before allocating a huge amount of memory for corrupted files, check | ||
| 120 | + * if size of requested memory is not greater than file size. */ | ||
| 121 | + uint64_t filesize = TIFFGetFileSize(tif); | ||
| 122 | + uint64_t allocsize = (uint64_t)nstrips * sizeof(uint64_t); | ||
| 123 | + if (allocsize > filesize) | ||
| 124 | + { | ||
| 125 | + TIFFWarningExtR(tif, module, | ||
| 126 | + "Requested memory size for StripArray of %" PRIu64 | ||
| 127 | + " is greather than filesize %" PRIu64 | ||
| 128 | + ". Memory not allocated", | ||
| 129 | + allocsize, filesize); | ||
| 130 | + _TIFFfreeExt(tif, data); | ||
| 131 | + return (0); | ||
| 132 | + } | ||
| 133 | resizeddata = (uint64_t *)_TIFFCheckMalloc( | ||
| 134 | tif, nstrips, sizeof(uint64_t), "for strip array"); | ||
| 135 | if (resizeddata == 0) | ||
| 136 | @@ -7263,6 +7336,23 @@ static void allocChoppedUpStripArrays(TIFF *tif, uint32_t nstrips, | ||
| 137 | } | ||
| 138 | bytecount = last_offset + last_bytecount - offset; | ||
| 139 | |||
| 140 | + /* Before allocating a huge amount of memory for corrupted files, check if | ||
| 141 | + * size of StripByteCount and StripOffset tags is not greater than | ||
| 142 | + * file size. | ||
| 143 | + */ | ||
| 144 | + uint64_t allocsize = (uint64_t)nstrips * sizeof(uint64_t) * 2; | ||
| 145 | + uint64_t filesize = TIFFGetFileSize(tif); | ||
| 146 | + if (allocsize > filesize) | ||
| 147 | + { | ||
| 148 | + TIFFWarningExtR(tif, "allocChoppedUpStripArrays", | ||
| 149 | + "Requested memory size for StripByteCount and " | ||
| 150 | + "StripOffsets %" PRIu64 | ||
| 151 | + " is greather than filesize %" PRIu64 | ||
| 152 | + ". Memory not allocated", | ||
| 153 | + allocsize, filesize); | ||
| 154 | + return; | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | newcounts = | ||
| 158 | (uint64_t *)_TIFFCheckMalloc(tif, nstrips, sizeof(uint64_t), | ||
| 159 | "for chopped \"StripByteCounts\" array"); | ||
| 160 | -- | ||
| 161 | 2.43.0 | ||
| 162 | |||
diff --git a/meta/recipes-multimedia/libtiff/tiff/CVE-2024-7006.patch b/meta/recipes-multimedia/libtiff/tiff/CVE-2024-7006.patch deleted file mode 100644 index 785244bdea..0000000000 --- a/meta/recipes-multimedia/libtiff/tiff/CVE-2024-7006.patch +++ /dev/null | |||
| @@ -1,65 +0,0 @@ | |||
| 1 | From 8ee0e7d2bdcc1a5a5a3241904b243964ab947b7b Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Su_Laus <sulau@freenet.de> | ||
| 3 | Date: Fri, 1 Dec 2023 20:12:25 +0100 | ||
| 4 | Subject: [PATCH] Check return value of _TIFFCreateAnonField(). | ||
| 5 | |||
| 6 | Fixes #624 | ||
| 7 | |||
| 8 | Upstream-Status: Backport [https://gitlab.com/libtiff/libtiff/-/commit/818fb8ce881cf839fbc710f6690aadb992aa0f9e] | ||
| 9 | CVE: CVE-2024-7006 | ||
| 10 | Signed-off-by: Siddharth Doshi <sdoshi@mvista.com> | ||
| 11 | --- | ||
| 12 | libtiff/tif_dirinfo.c | 2 +- | ||
| 13 | libtiff/tif_dirread.c | 16 ++++++---------- | ||
| 14 | 2 files changed, 7 insertions(+), 11 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/libtiff/tif_dirinfo.c b/libtiff/tif_dirinfo.c | ||
| 17 | index 0e705e8..4cfdaad 100644 | ||
| 18 | --- a/libtiff/tif_dirinfo.c | ||
| 19 | +++ b/libtiff/tif_dirinfo.c | ||
| 20 | @@ -887,7 +887,7 @@ const TIFFField *_TIFFFindOrRegisterField(TIFF *tif, uint32_t tag, | ||
| 21 | if (fld == NULL) | ||
| 22 | { | ||
| 23 | fld = _TIFFCreateAnonField(tif, tag, dt); | ||
| 24 | - if (!_TIFFMergeFields(tif, fld, 1)) | ||
| 25 | + if (fld == NULL || !_TIFFMergeFields(tif, fld, 1)) | ||
| 26 | return NULL; | ||
| 27 | } | ||
| 28 | |||
| 29 | diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c | ||
| 30 | index 58a4276..738df9f 100644 | ||
| 31 | --- a/libtiff/tif_dirread.c | ||
| 32 | +++ b/libtiff/tif_dirread.c | ||
| 33 | @@ -4275,11 +4275,9 @@ int TIFFReadDirectory(TIFF *tif) | ||
| 34 | dp->tdir_tag, dp->tdir_tag); | ||
| 35 | /* the following knowingly leaks the | ||
| 36 | anonymous field structure */ | ||
| 37 | - if (!_TIFFMergeFields( | ||
| 38 | - tif, | ||
| 39 | - _TIFFCreateAnonField(tif, dp->tdir_tag, | ||
| 40 | - (TIFFDataType)dp->tdir_type), | ||
| 41 | - 1)) | ||
| 42 | + const TIFFField *fld = _TIFFCreateAnonField( | ||
| 43 | + tif, dp->tdir_tag, (TIFFDataType)dp->tdir_type); | ||
| 44 | + if (fld == NULL || !_TIFFMergeFields(tif, fld, 1)) | ||
| 45 | { | ||
| 46 | TIFFWarningExtR( | ||
| 47 | tif, module, | ||
| 48 | @@ -5153,11 +5151,9 @@ int TIFFReadCustomDirectory(TIFF *tif, toff_t diroff, | ||
| 49 | "Unknown field with tag %" PRIu16 " (0x%" PRIx16 | ||
| 50 | ") encountered", | ||
| 51 | dp->tdir_tag, dp->tdir_tag); | ||
| 52 | - if (!_TIFFMergeFields( | ||
| 53 | - tif, | ||
| 54 | - _TIFFCreateAnonField(tif, dp->tdir_tag, | ||
| 55 | - (TIFFDataType)dp->tdir_type), | ||
| 56 | - 1)) | ||
| 57 | + const TIFFField *fld = _TIFFCreateAnonField( | ||
| 58 | + tif, dp->tdir_tag, (TIFFDataType)dp->tdir_type); | ||
| 59 | + if (fld == NULL || !_TIFFMergeFields(tif, fld, 1)) | ||
| 60 | { | ||
| 61 | TIFFWarningExtR(tif, module, | ||
| 62 | "Registering anonymous field with tag %" PRIu16 | ||
| 63 | -- | ||
| 64 | 2.44.1 | ||
| 65 | |||
diff --git a/meta/recipes-multimedia/libtiff/tiff_4.6.0.bb b/meta/recipes-multimedia/libtiff/tiff_4.7.0.bb index 6bf7010ba2..474fe1e8fd 100644 --- a/meta/recipes-multimedia/libtiff/tiff_4.6.0.bb +++ b/meta/recipes-multimedia/libtiff/tiff_4.7.0.bb | |||
| @@ -8,18 +8,9 @@ LIC_FILES_CHKSUM = "file://LICENSE.md;md5=a3e32d664d6db1386b4689c8121531c3" | |||
| 8 | 8 | ||
| 9 | CVE_PRODUCT = "libtiff" | 9 | CVE_PRODUCT = "libtiff" |
| 10 | 10 | ||
| 11 | SRC_URI = "http://download.osgeo.org/libtiff/tiff-${PV}.tar.gz \ | 11 | SRC_URI = "http://download.osgeo.org/libtiff/tiff-${PV}.tar.gz" |
| 12 | file://CVE-2023-6277-At-image-reading-compare-data-size-of-some-tags-data.patch \ | 12 | |
| 13 | file://CVE-2023-6277-At-image-reading-compare-data-size-of-some-tags-data-2.patch \ | 13 | SRC_URI[sha256sum] = "67160e3457365ab96c5b3286a0903aa6e78bdc44c4bc737d2e486bcecb6ba976" |
| 14 | file://CVE-2023-6277-Apply-1-suggestion-s-to-1-file-s.patch \ | ||
| 15 | file://CVE-2023-6228.patch \ | ||
| 16 | file://CVE-2023-52355-0001.patch \ | ||
| 17 | file://CVE-2023-52355-0002.patch \ | ||
| 18 | file://CVE-2023-52356.patch \ | ||
| 19 | file://CVE-2024-7006.patch \ | ||
| 20 | " | ||
| 21 | |||
| 22 | SRC_URI[sha256sum] = "88b3979e6d5c7e32b50d7ec72fb15af724f6ab2cbf7e10880c360a77e4b5d99a" | ||
| 23 | 14 | ||
| 24 | # exclude betas | 15 | # exclude betas |
| 25 | UPSTREAM_CHECK_REGEX = "tiff-(?P<pver>\d+(\.\d+)+).tar" | 16 | UPSTREAM_CHECK_REGEX = "tiff-(?P<pver>\d+(\.\d+)+).tar" |
