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 @@ | |||
1 | From 02875964eba5c4a2ea98c41562835428214adfe7 Mon Sep 17 00:00:00 2001 | ||
2 | From: Thomas Bernard <miniupnp@free.fr> | ||
3 | Date: Sat, 7 Mar 2020 13:21:56 +0100 | ||
4 | Subject: [PATCH] tiff2rgba: output usage to stdout when using -h | ||
5 | |||
6 | also uses std C EXIT_FAILURE / EXIT_SUCCESS | ||
7 | see #17 | ||
8 | |||
9 | Signed-off-by: akash hadke <akash.hadke@kpit.com> | ||
10 | --- | ||
11 | tools/tiff2rgba.c | 39 ++++++++++++++++++++++++--------------- | ||
12 | 1 file changed, 24 insertions(+), 15 deletions(-) | ||
13 | --- | ||
14 | Upstream-Status: Backport [https://gitlab.com/libtiff/libtiff/-/commit/02875964eba5c4a2ea98c41562835428214adfe7.patch] | ||
15 | --- | ||
16 | diff --git a/tools/tiff2rgba.c b/tools/tiff2rgba.c | ||
17 | index 2eb6f6c4..ef643653 100644 | ||
18 | --- a/tools/tiff2rgba.c | ||
19 | +++ b/tools/tiff2rgba.c | ||
20 | @@ -39,6 +39,13 @@ | ||
21 | #include "tiffiop.h" | ||
22 | #include "tiffio.h" | ||
23 | |||
24 | +#ifndef EXIT_SUCCESS | ||
25 | +#define EXIT_SUCCESS 0 | ||
26 | +#endif | ||
27 | +#ifndef EXIT_FAILURE | ||
28 | +#define EXIT_FAILURE 1 | ||
29 | +#endif | ||
30 | + | ||
31 | #define streq(a,b) (strcmp(a,b) == 0) | ||
32 | #define CopyField(tag, v) \ | ||
33 | if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v) | ||
34 | @@ -68,7 +75,7 @@ main(int argc, char* argv[]) | ||
35 | extern char *optarg; | ||
36 | #endif | ||
37 | |||
38 | - while ((c = getopt(argc, argv, "c:r:t:bn8")) != -1) | ||
39 | + while ((c = getopt(argc, argv, "c:r:t:bn8h")) != -1) | ||
40 | switch (c) { | ||
41 | case 'b': | ||
42 | process_by_block = 1; | ||
43 | @@ -86,7 +93,7 @@ main(int argc, char* argv[]) | ||
44 | else if (streq(optarg, "zip")) | ||
45 | compression = COMPRESSION_DEFLATE; | ||
46 | else | ||
47 | - usage(-1); | ||
48 | + usage(EXIT_FAILURE); | ||
49 | break; | ||
50 | |||
51 | case 'r': | ||
52 | @@ -105,17 +112,20 @@ main(int argc, char* argv[]) | ||
53 | bigtiff_output = 1; | ||
54 | break; | ||
55 | |||
56 | + case 'h': | ||
57 | + usage(EXIT_SUCCESS); | ||
58 | + /*NOTREACHED*/ | ||
59 | case '?': | ||
60 | - usage(0); | ||
61 | + usage(EXIT_FAILURE); | ||
62 | /*NOTREACHED*/ | ||
63 | } | ||
64 | |||
65 | if (argc - optind < 2) | ||
66 | - usage(-1); | ||
67 | + usage(EXIT_FAILURE); | ||
68 | |||
69 | out = TIFFOpen(argv[argc-1], bigtiff_output?"w8":"w"); | ||
70 | if (out == NULL) | ||
71 | - return (-2); | ||
72 | + return (EXIT_FAILURE); | ||
73 | |||
74 | for (; optind < argc-1; optind++) { | ||
75 | in = TIFFOpen(argv[optind], "r"); | ||
76 | @@ -132,7 +142,7 @@ main(int argc, char* argv[]) | ||
77 | } | ||
78 | } | ||
79 | (void) TIFFClose(out); | ||
80 | - return (0); | ||
81 | + return (EXIT_SUCCESS); | ||
82 | } | ||
83 | |||
84 | static int | ||
85 | @@ -166,7 +176,7 @@ cvt_by_tile( TIFF *in, TIFF *out ) | ||
86 | if (tile_width != (rastersize / tile_height) / sizeof( uint32)) | ||
87 | { | ||
88 | TIFFError(TIFFFileName(in), "Integer overflow when calculating raster buffer"); | ||
89 | - exit(-1); | ||
90 | + exit(EXIT_FAILURE); | ||
91 | } | ||
92 | raster = (uint32*)_TIFFmalloc(rastersize); | ||
93 | if (raster == 0) { | ||
94 | @@ -182,7 +192,7 @@ cvt_by_tile( TIFF *in, TIFF *out ) | ||
95 | if (tile_width != wrk_linesize / sizeof (uint32)) | ||
96 | { | ||
97 | TIFFError(TIFFFileName(in), "Integer overflow when calculating wrk_line buffer"); | ||
98 | - exit(-1); | ||
99 | + exit(EXIT_FAILURE); | ||
100 | } | ||
101 | wrk_line = (uint32*)_TIFFmalloc(wrk_linesize); | ||
102 | if (!wrk_line) { | ||
103 | @@ -279,7 +289,7 @@ cvt_by_strip( TIFF *in, TIFF *out ) | ||
104 | if (width != (rastersize / rowsperstrip) / sizeof( uint32)) | ||
105 | { | ||
106 | TIFFError(TIFFFileName(in), "Integer overflow when calculating raster buffer"); | ||
107 | - exit(-1); | ||
108 | + exit(EXIT_FAILURE); | ||
109 | } | ||
110 | raster = (uint32*)_TIFFmalloc(rastersize); | ||
111 | if (raster == 0) { | ||
112 | @@ -295,7 +305,7 @@ cvt_by_strip( TIFF *in, TIFF *out ) | ||
113 | if (width != wrk_linesize / sizeof (uint32)) | ||
114 | { | ||
115 | TIFFError(TIFFFileName(in), "Integer overflow when calculating wrk_line buffer"); | ||
116 | - exit(-1); | ||
117 | + exit(EXIT_FAILURE); | ||
118 | } | ||
119 | wrk_line = (uint32*)_TIFFmalloc(wrk_linesize); | ||
120 | if (!wrk_line) { | ||
121 | @@ -528,7 +538,7 @@ tiffcvt(TIFF* in, TIFF* out) | ||
122 | return( cvt_whole_image( in, out ) ); | ||
123 | } | ||
124 | |||
125 | -static char* stuff[] = { | ||
126 | +const static char* stuff[] = { | ||
127 | "usage: tiff2rgba [-c comp] [-r rows] [-b] [-n] [-8] input... output", | ||
128 | "where comp is one of the following compression algorithms:", | ||
129 | " jpeg\t\tJPEG encoding", | ||
130 | @@ -547,13 +557,12 @@ static char* stuff[] = { | ||
131 | static void | ||
132 | usage(int code) | ||
133 | { | ||
134 | - char buf[BUFSIZ]; | ||
135 | int i; | ||
136 | + FILE * out = (code == EXIT_SUCCESS) ? stdout : stderr; | ||
137 | |||
138 | - setbuf(stderr, buf); | ||
139 | - fprintf(stderr, "%s\n\n", TIFFGetVersion()); | ||
140 | + fprintf(out, "%s\n\n", TIFFGetVersion()); | ||
141 | for (i = 0; stuff[i] != NULL; i++) | ||
142 | - fprintf(stderr, "%s\n", stuff[i]); | ||
143 | + fprintf(out, "%s\n", stuff[i]); | ||
144 | exit(code); | ||
145 | } | ||
146 | |||
147 | -- | ||
148 | GitLab | ||