-
Notifications
You must be signed in to change notification settings - Fork 8
/
10278.diff
195 lines (185 loc) · 8.21 KB
/
10278.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
changeset: 15792:d6035da9dc0d
user: Bob Friesenhahn <[email protected]>
date: Sun Sep 09 14:32:32 2018 -0500
summary: Fix minor Coverity gripes.
diff -r f6aab6087677 -r d6035da9dc0d ChangeLog
--- a/ChangeLog Sun Sep 09 13:00:14 2018 -0500
+++ b/ChangeLog Sun Sep 09 14:32:32 2018 -0500
@@ -1,5 +1,11 @@
2018-09-09 Bob Friesenhahn <[email protected]>
+ * magick/render.c (DrawClipPath): Fix Coverity 319663 "Null
+ pointer dereferences". Totally insignificant.
+
+ * coders/wpg.c (ReadWPGImage): Mask/fix Coverity 319664 "Error
+ handling issues".
+
* magick/attribute.c (FindEXIFAttribute): Change size types from
signed to unsigned and check for unsigned overflow.
(GenerateEXIFAttribute): Change size types from signed to unsigned
diff -r f6aab6087677 -r d6035da9dc0d coders/wpg.c
--- a/coders/wpg.c Sun Sep 09 13:00:14 2018 -0500
+++ b/coders/wpg.c Sun Sep 09 14:32:32 2018 -0500
@@ -392,13 +392,14 @@
/** Call this function to ensure that all data matrix is filled with something. This function
* is used only to error recovery. */
-static void ZeroFillMissingData(unsigned char *BImgBuff,unsigned long x, unsigned long y, Image *image,
- int bpp, long ldblk)
+static void ZeroFillMissingData(unsigned char *BImgBuff,unsigned long x, unsigned long y, Image *image,
+ int bpp, long ldblk)
{
while(y < image->rows)
{
- if(x<ldblk) memset(BImgBuff+x, 0, ldblk-x);
- InsertRow(BImgBuff,y,image,bpp);
+ if((long) x<ldblk) memset(BImgBuff+x, 0, ldblk-(long)x);
+ if (InsertRow(BImgBuff,y,image,bpp) == MagickFail)
+ break;
x = 0;
y++;
}
@@ -442,7 +443,7 @@
i = ReadBlobByte(image);
if(i==EOF)
{
- ZeroFillMissingData(BImgBuff,x,y,image,bpp,ldblk);
+ ZeroFillMissingData(BImgBuff,x,y,image,bpp,ldblk);
MagickFreeMemory(BImgBuff);
return(-5);
}
@@ -474,32 +475,34 @@
i = ReadBlobByte(image);
if(i==EOF)
{
- ZeroFillMissingData(BImgBuff,x,y,image,bpp,ldblk);
+ ZeroFillMissingData(BImgBuff,x,y,image,bpp,ldblk);
MagickFreeMemory(BImgBuff);
return -7;
}
RunCount = i;
if(x!=0) { /* attempt to duplicate row from x position: */
/* I do not know what to do here */
- InsertRow(BImgBuff,y,image,bpp); /* May be line flush can fix a situation. */
- x=0;
- y++;
- ZeroFillMissingData(BImgBuff,x,y,image,bpp,ldblk);
+ if (InsertRow(BImgBuff,y,image,bpp) == MagickPass) /* May be line flush can fix a situation. */
+ {
+ x=0;
+ y++;
+ ZeroFillMissingData(BImgBuff,x,y,image,bpp,ldblk);
+ }
MagickFreeMemory(BImgBuff);
return(-3);
}
for(i=0; i<(int)RunCount; i++)
- { /* Here I need to duplicate previous row RUNCOUNT* */
- /* when x=0; y points to a new empty line. For y=0 zero line will be populated. */
+ { /* Here I need to duplicate previous row RUNCOUNT* */
+ /* when x=0; y points to a new empty line. For y=0 zero line will be populated. */
if(y>=image->rows)
{
- ZeroFillMissingData(BImgBuff,x,y,image,bpp,ldblk);
+ ZeroFillMissingData(BImgBuff,x,y,image,bpp,ldblk);
MagickFreeMemory(BImgBuff);
return(-4);
}
if(InsertRow(BImgBuff,y,image,bpp)==MagickFail)
{
- ZeroFillMissingData(BImgBuff,x,y,image,bpp,ldblk);
+ ZeroFillMissingData(BImgBuff,x,y,image,bpp,ldblk);
MagickFreeMemory(BImgBuff);
return(-6);
}
@@ -1108,10 +1111,10 @@
if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),
"File type: %d", Header.FileType);
- /* Determine file size. */
- filesize = GetBlobSize(image); /* zero is returned if the size cannot be determined. */
+ /* Determine file size. */
+ filesize = GetBlobSize(image); /* zero is returned if the size cannot be determined. */
if(filesize>0 && BlobIsSeekable(image))
- {
+ {
if(filesize > (magick_off_t)0xFFFFFFFF)
filesize = (magick_off_t)0xFFFFFFFF; /* More than 4GiB are not supported in MAT! */
}
@@ -1131,29 +1134,29 @@
while(!EOFBlob(image)) /* object parser loop */
{
if(SeekBlob(image,FilePos,SEEK_SET) != FilePos)
- break;
+ break;
Rec.RecType = (i=ReadBlobByte(image));
if(i==EOF) break;
- FilePos += 1;
+ FilePos += 1;
FilePos += Rd_WP_DWORD(image,&Rec.RecordLength);
if((magick_off_t)Rec.RecordLength > filesize)
ThrowReaderException(CorruptImageError,ImproperImageHeader,image);
if(EOFBlob(image)) break;
-
- FilePos += (magick_off_t)Rec.RecordLength;
+
+ FilePos += (magick_off_t)Rec.RecordLength;
if(FilePos>filesize || FilePos<Header.DataOffset)
- {
+ {
if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),
"Invalid record length: %X", (unsigned)Rec.RecType);
- break;
- }
+ break;
+ }
Header.DataOffset = FilePos;
if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),
"Parsing object: %X", Rec.RecType);
- //printf("\nParsing object: %u:%X", (unsigned)FilePos, Rec.RecType);
+ //printf("\nParsing object: %u:%X", (unsigned)FilePos, Rec.RecType);
switch(Rec.RecType)
{
@@ -1267,14 +1270,14 @@
if(bpp == 1)
{
if(image->colors<=0)
- {
- image->colormap[0].red =
+ {
+ image->colormap[0].red =
image->colormap[0].green =
image->colormap[0].blue = 0;
image->colormap[0].opacity = OpaqueOpacity;
- }
- if(image->colors<=1 || /* Realloc has been enforced and value [1] remains uninitialised, or .. */
- (image->colormap[0].red==0 && image->colormap[0].green==0 && image->colormap[0].blue==0 &&
+ }
+ if(image->colors<=1 || /* Realloc has been enforced and value [1] remains uninitialised, or .. */
+ (image->colormap[0].red==0 && image->colormap[0].green==0 && image->colormap[0].blue==0 &&
image->colormap[1].red==0 && image->colormap[1].green==0 && image->colormap[1].blue==0))
{ /* fix crippled monochrome palette */
image->colormap[1].red =
diff -r f6aab6087677 -r d6035da9dc0d magick/render.c
--- a/magick/render.c Sun Sep 09 13:00:14 2018 -0500
+++ b/magick/render.c Sun Sep 09 14:32:32 2018 -0500
@@ -1743,8 +1743,7 @@
clone_info->opacity = OpaqueOpacity; /* SVG default */
}
- if (clone_info != (DrawInfo *) NULL)
- MagickFreeMemory(clone_info->extra->clip_path);
+ MagickFreeMemory(clone_info->extra->clip_path);
if ((status=DrawImage(image_clip_mask,clone_info)) == MagickFail)
goto draw_clip_path_end;
if ((status=NegateImage(image_clip_mask,False)) == MagickFail)
diff -r f6aab6087677 -r d6035da9dc0d www/Changelog.html
--- a/www/Changelog.html Sun Sep 09 13:00:14 2018 -0500
+++ b/www/Changelog.html Sun Sep 09 14:32:32 2018 -0500
@@ -38,6 +38,10 @@
<p>2018-09-09 Bob Friesenhahn <<a class="reference external" href="mailto:bfriesen%40simple.dallas.tx.us">bfriesen<span>@</span>simple<span>.</span>dallas<span>.</span>tx<span>.</span>us</a>></p>
<blockquote>
<ul class="simple">
+<li>magick/render.c (DrawClipPath): Fix Coverity 319663 "Null
+pointer dereferences". Totally insignificant.</li>
+<li>coders/wpg.c (ReadWPGImage): Mask/fix Coverity 319664 "Error
+handling issues".</li>
<li>magick/attribute.c (FindEXIFAttribute): Change size types from
signed to unsigned and check for unsigned overflow.
(GenerateEXIFAttribute): Change size types from signed to unsigned