diff options
Diffstat (limited to 'meta/recipes-multimedia/libtiff/files/001_support_patch_for_CVE-2020-35521_and_CVE-2020-35522.patch')
-rw-r--r-- | meta/recipes-multimedia/libtiff/files/001_support_patch_for_CVE-2020-35521_and_CVE-2020-35522.patch | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/meta/recipes-multimedia/libtiff/files/001_support_patch_for_CVE-2020-35521_and_CVE-2020-35522.patch b/meta/recipes-multimedia/libtiff/files/001_support_patch_for_CVE-2020-35521_and_CVE-2020-35522.patch new file mode 100644 index 0000000000..9b4724a325 --- /dev/null +++ b/meta/recipes-multimedia/libtiff/files/001_support_patch_for_CVE-2020-35521_and_CVE-2020-35522.patch @@ -0,0 +1,148 @@ +From 02875964eba5c4a2ea98c41562835428214adfe7 Mon Sep 17 00:00:00 2001 +From: Thomas Bernard <miniupnp@free.fr> +Date: Sat, 7 Mar 2020 13:21:56 +0100 +Subject: [PATCH] tiff2rgba: output usage to stdout when using -h + +also uses std C EXIT_FAILURE / EXIT_SUCCESS +see #17 + +Signed-off-by: akash hadke <akash.hadke@kpit.com> +--- + tools/tiff2rgba.c | 39 ++++++++++++++++++++++++--------------- + 1 file changed, 24 insertions(+), 15 deletions(-) +--- +Upstream-Status: Backport [https://gitlab.com/libtiff/libtiff/-/commit/02875964eba5c4a2ea98c41562835428214adfe7.patch] +--- +diff --git a/tools/tiff2rgba.c b/tools/tiff2rgba.c +index 2eb6f6c4..ef643653 100644 +--- a/tools/tiff2rgba.c ++++ b/tools/tiff2rgba.c +@@ -39,6 +39,13 @@ + #include "tiffiop.h" + #include "tiffio.h" + ++#ifndef EXIT_SUCCESS ++#define EXIT_SUCCESS 0 ++#endif ++#ifndef EXIT_FAILURE ++#define EXIT_FAILURE 1 ++#endif ++ + #define streq(a,b) (strcmp(a,b) == 0) + #define CopyField(tag, v) \ + if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v) +@@ -68,7 +75,7 @@ main(int argc, char* argv[]) + extern char *optarg; + #endif + +- while ((c = getopt(argc, argv, "c:r:t:bn8")) != -1) ++ while ((c = getopt(argc, argv, "c:r:t:bn8h")) != -1) + switch (c) { + case 'b': + process_by_block = 1; +@@ -86,7 +93,7 @@ main(int argc, char* argv[]) + else if (streq(optarg, "zip")) + compression = COMPRESSION_DEFLATE; + else +- usage(-1); ++ usage(EXIT_FAILURE); + break; + + case 'r': +@@ -105,17 +112,20 @@ main(int argc, char* argv[]) + bigtiff_output = 1; + break; + ++ case 'h': ++ usage(EXIT_SUCCESS); ++ /*NOTREACHED*/ + case '?': +- usage(0); ++ usage(EXIT_FAILURE); + /*NOTREACHED*/ + } + + if (argc - optind < 2) +- usage(-1); ++ usage(EXIT_FAILURE); + + out = TIFFOpen(argv[argc-1], bigtiff_output?"w8":"w"); + if (out == NULL) +- return (-2); ++ return (EXIT_FAILURE); + + for (; optind < argc-1; optind++) { + in = TIFFOpen(argv[optind], "r"); +@@ -132,7 +142,7 @@ main(int argc, char* argv[]) + } + } + (void) TIFFClose(out); +- return (0); ++ return (EXIT_SUCCESS); + } + + static int +@@ -166,7 +176,7 @@ cvt_by_tile( TIFF *in, TIFF *out ) + if (tile_width != (rastersize / tile_height) / sizeof( uint32)) + { + TIFFError(TIFFFileName(in), "Integer overflow when calculating raster buffer"); +- exit(-1); ++ exit(EXIT_FAILURE); + } + raster = (uint32*)_TIFFmalloc(rastersize); + if (raster == 0) { +@@ -182,7 +192,7 @@ cvt_by_tile( TIFF *in, TIFF *out ) + if (tile_width != wrk_linesize / sizeof (uint32)) + { + TIFFError(TIFFFileName(in), "Integer overflow when calculating wrk_line buffer"); +- exit(-1); ++ exit(EXIT_FAILURE); + } + wrk_line = (uint32*)_TIFFmalloc(wrk_linesize); + if (!wrk_line) { +@@ -279,7 +289,7 @@ cvt_by_strip( TIFF *in, TIFF *out ) + if (width != (rastersize / rowsperstrip) / sizeof( uint32)) + { + TIFFError(TIFFFileName(in), "Integer overflow when calculating raster buffer"); +- exit(-1); ++ exit(EXIT_FAILURE); + } + raster = (uint32*)_TIFFmalloc(rastersize); + if (raster == 0) { +@@ -295,7 +305,7 @@ cvt_by_strip( TIFF *in, TIFF *out ) + if (width != wrk_linesize / sizeof (uint32)) + { + TIFFError(TIFFFileName(in), "Integer overflow when calculating wrk_line buffer"); +- exit(-1); ++ exit(EXIT_FAILURE); + } + wrk_line = (uint32*)_TIFFmalloc(wrk_linesize); + if (!wrk_line) { +@@ -528,7 +538,7 @@ tiffcvt(TIFF* in, TIFF* out) + return( cvt_whole_image( in, out ) ); + } + +-static char* stuff[] = { ++const static char* stuff[] = { + "usage: tiff2rgba [-c comp] [-r rows] [-b] [-n] [-8] input... output", + "where comp is one of the following compression algorithms:", + " jpeg\t\tJPEG encoding", +@@ -547,13 +557,12 @@ static char* stuff[] = { + static void + usage(int code) + { +- char buf[BUFSIZ]; + int i; ++ FILE * out = (code == EXIT_SUCCESS) ? stdout : stderr; + +- setbuf(stderr, buf); +- fprintf(stderr, "%s\n\n", TIFFGetVersion()); ++ fprintf(out, "%s\n\n", TIFFGetVersion()); + for (i = 0; stuff[i] != NULL; i++) +- fprintf(stderr, "%s\n", stuff[i]); ++ fprintf(out, "%s\n", stuff[i]); + exit(code); + } + +-- +GitLab |