/[packages]/updates/5/imagemagick/current/SOURCES/0054-Fix-a-DOS-in-HDR-file.patch
ViewVC logotype

Contents of /updates/5/imagemagick/current/SOURCES/0054-Fix-a-DOS-in-HDR-file.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 909141 - (show annotations) (download)
Wed Dec 9 16:30:45 2015 UTC (8 years, 4 months ago) by luigiwalser
File size: 3794 byte(s)
add patches from debian and upstream to fix various security issues (mga#17318)
1 From d99d71cb30b0214ed1e27bc104e2b738048130e1 Mon Sep 17 00:00:00 2001
2 From: dirk <dirk@aa41f4f7-0bf4-0310-aa73-e5a19afd5a74>
3 Date: Sun, 25 Jan 2015 07:32:56 +0000
4 Subject: Fix a DOS in HDR file
5
6 Fixed infinite loop and added checks for the sscanf result.
7
8 git-svn-id: https://subversion.imagemagick.org/subversion/ImageMagick/branches/ImageMagick-6@17846 aa41f4f7-0bf4-0310-aa73-e5a19afd5a74
9 origin: http://trac.imagemagick.org/changeset/17846
10 ---
11 coders/hdr.c | 36 ++++++++++++++++++++----------------
12 1 file changed, 20 insertions(+), 16 deletions(-)
13
14 diff --git a/coders/hdr.c b/coders/hdr.c
15 index 2f5a9ef..0723fe6 100644
16 --- a/coders/hdr.c
17 +++ b/coders/hdr.c
18 @@ -273,7 +273,7 @@ static Image *ReadHDRImage(const ImageInfo *image_info,ExceptionInfo *exception)
19 if (value_expected == MagickFalse)
20 continue;
21 p=value;
22 - while ((c != '\n') && (c != '\0'))
23 + while ((c != '\n') && (c != '\0') && (c != EOF))
24 {
25 if ((size_t) (p-value) < (MaxTextExtent-1))
26 *p++=c;
27 @@ -318,18 +318,20 @@ static Image *ReadHDRImage(const ImageInfo *image_info,ExceptionInfo *exception)
28 chromaticity[6],
29 white_point[2];
30
31 - (void) sscanf(value,"%g %g %g %g %g %g %g %g",
32 - &chromaticity[0],&chromaticity[1],&chromaticity[2],
33 - &chromaticity[3],&chromaticity[4],&chromaticity[5],
34 - &white_point[0],&white_point[1]);
35 - image->chromaticity.red_primary.x=chromaticity[0];
36 - image->chromaticity.red_primary.y=chromaticity[1];
37 - image->chromaticity.green_primary.x=chromaticity[2];
38 - image->chromaticity.green_primary.y=chromaticity[3];
39 - image->chromaticity.blue_primary.x=chromaticity[4];
40 - image->chromaticity.blue_primary.y=chromaticity[5];
41 - image->chromaticity.white_point.x=white_point[0],
42 - image->chromaticity.white_point.y=white_point[1];
43 + if (sscanf(value,"%g %g %g %g %g %g %g %g",&chromaticity[0],
44 + &chromaticity[1],&chromaticity[2],&chromaticity[3],
45 + &chromaticity[4],&chromaticity[5],&white_point[0],
46 + &white_point[1]) == 8)
47 + {
48 + image->chromaticity.red_primary.x=chromaticity[0];
49 + image->chromaticity.red_primary.y=chromaticity[1];
50 + image->chromaticity.green_primary.x=chromaticity[2];
51 + image->chromaticity.green_primary.y=chromaticity[3];
52 + image->chromaticity.blue_primary.x=chromaticity[4];
53 + image->chromaticity.blue_primary.y=chromaticity[5];
54 + image->chromaticity.white_point.x=white_point[0],
55 + image->chromaticity.white_point.y=white_point[1];
56 + }
57 break;
58 }
59 (void) FormatLocaleString(tag,MaxTextExtent,"hdr:%s",keyword);
60 @@ -345,9 +347,11 @@ static Image *ReadHDRImage(const ImageInfo *image_info,ExceptionInfo *exception)
61 height,
62 width;
63
64 - (void) sscanf(value,"%d +X %d",&height,&width);
65 - image->columns=(size_t) width;
66 - image->rows=(size_t) height;
67 + if (sscanf(value,"%d +X %d",&height,&width) == 2)
68 + {
69 + image->columns=(size_t) width;
70 + image->rows=(size_t) height;
71 + }
72 break;
73 }
74 (void) FormatLocaleString(tag,MaxTextExtent,"hdr:%s",keyword);
75 --
76 cgit v0.11.2
77

  ViewVC Help
Powered by ViewVC 1.1.30