Accepting request 506061 from graphics

1

OBS-URL: https://build.opensuse.org/request/show/506061
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/gifsicle?expand=0&rev=3
This commit is contained in:
Dominique Leuenberger 2017-06-26 13:55:04 +00:00 committed by Git OBS Bridge
commit 73fd93dfaa
6 changed files with 117 additions and 0 deletions

View File

@ -0,0 +1,18 @@
Correct uninitialized-memory bug with zero-element colormaps.
Tim Strazzere report. Also fixed by a0a3651.
diff --git a/src/opttemplate.c b/src/opttemplate.c
index 1f96c41..407b940 100644
--- a/src/opttemplate.c
+++ b/src/opttemplate.c
@@ -146,8 +146,9 @@ X(apply_frame)(palindex_type *dst, Gif_Stream* gfs, Gif_Image* gfi,
for (i = 0; i < colormap->ncol; i++)
map[i] = colormap->col[i].pixel;
/* out-of-bounds colors map to 0, for the sake of argument */
+ y = colormap->ncol ? colormap->col[0].pixel : 0;
for (i = colormap->ncol; i < 256; i++)
- map[i] = colormap->col[0].pixel;
+ map[i] = y;
if (gfi->transparent >= 0 && gfi->transparent < 256)
map[gfi->transparent] = TRANSP;
else

View File

@ -0,0 +1,39 @@
diff --git a/src/gifsicle.c b/src/gifsicle.c
index d474dfc..c0de94b 100644
--- a/src/gifsicle.c
+++ b/src/gifsicle.c
@@ -521,8 +521,6 @@ show_frame(int imagenumber, int usename)
* input a stream
**/
-static int gifread_error_count;
-
static void
gifread_error(Gif_Stream* gfs, Gif_Image* gfi,
int is_error, const char* message)
@@ -732,15 +730,20 @@ input_stream(const char *name)
verbose_open('<', name);
/* read file */
- gifread_error_count = 0;
- gfs = Gif_FullReadFile(f, gif_read_flags | GIF_READ_COMPRESSED,
- name, gifread_error);
+ {
+ int old_error_count = error_count;
+ gfs = Gif_FullReadFile(f, gif_read_flags | GIF_READ_COMPRESSED,
+ name, gifread_error);
+ if ((!gfs || (Gif_ImageCount(gfs) == 0 && gfs->errors > 0))
+ && componentno != 1)
+ lerror(name, "trailing garbage ignored");
+ if (!no_ignore_errors)
+ error_count = old_error_count;
+ }
if (!gfs || (Gif_ImageCount(gfs) == 0 && gfs->errors > 0)) {
if (componentno == 1)
lerror(name, "file not in GIF format");
- else
- lerror(name, "trailing garbage ignored");
Gif_DeleteStream(gfs);
if (verbosing)
verbose_close('>');

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Sat Jun 24 23:25:25 CEST 2017 - manfred99@gmx.ch
- add initialize_missing_image.patch:
upstream fix, first hunk of commit a0a365136f44e5519f7f486b00a67387f641d0e8
- add correct_zero-element_colormaps.patch:
upstream fix, commit 1638a43201436f796bdf46d33b87468c089e90b8
-------------------------------------------------------------------
Fri Apr 21 17:34:28 CEST 2017 - manfred99@gmx.ch
- add no_status-1_when_valid_output.patch:
upstream fix, commit 0e02f7b62a9a3a344c34f92ddb7e178ad3b3e3ff
- add fix_ignore-errors_and_merge_mode.patch:
upstream fix, commit 62110e4392230a7e49c339173ee41128ba4ccea9
-------------------------------------------------------------------
Mon Apr 10 16:40:40 CEST 2017 - manfred99@gmx.ch

View File

@ -29,6 +29,10 @@ Patch1: coverity.patch
Patch2: coverity2.patch
Patch3: document-no-conserve-memory.patch
Patch4: fix-out-of-bound.patch
Patch5: no_status-1_when_valid_output.patch
Patch6: fix_ignore-errors_and_merge_mode.patch
Patch7: initialize_missing_image.patch
Patch8: correct_zero-element_colormaps.patch
Obsoletes: ungifsicle < %{version}
Provides: ungifsicle = %{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -69,6 +73,10 @@ GIF-manipulating software.
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
autoreconf
%build

View File

@ -0,0 +1,15 @@
Set missing image data to 0, rather than leaving it uninitialized.
Avoid valgrind warnings.
diff --git a/src/gifread.c b/src/gifread.c
index d2021ee..e9a58dd 100644
--- a/src/gifread.c
+++ b/src/gifread.c
@@ -373,6 +373,7 @@ read_image_data(Gif_Context *gfc, Gif_Reader *grr)
sprintf(buf, "missing %ld %s of image data", delta,
delta == 1 ? "pixel" : "pixels");
gif_read_error(gfc, 1, buf);
+ memset(&gfc->image[gfc->decodepos], 0, delta);
} else if (delta < -1) {
/* One pixel of superfluous data is OK; that could be the
code == next_code case. */

View File

@ -0,0 +1,21 @@
diff --git a/src/support.c b/src/support.c
index 2094b0a..fe247a8 100644
--- a/src/support.c
+++ b/src/support.c
@@ -1109,14 +1109,14 @@ find_color_or_error(Gif_Color *color, Gif_Stream *gfs, Gif_Image *gfi,
return color->pixel;
else {
if (color_context)
- lerror(gfs->landmark, "%s color out of range", color_context);
+ lwarning(gfs->landmark, "%s color out of range", color_context);
return -1;
}
}
index = Gif_FindColor(gfcm, color);
if (index < 0 && color_context)
- lerror(gfs->landmark, "%s color not in colormap", color_context);
+ lwarning(gfs->landmark, "%s color not in colormap", color_context);
return index;
}