453bd649bf
add upstream fix for null pointer deref in gifdiff.c OBS-URL: https://build.opensuse.org/request/show/597415 OBS-URL: https://build.opensuse.org/package/show/graphics/gifsicle?expand=0&rev=19
41 lines
1.3 KiB
Diff
41 lines
1.3 KiB
Diff
From e2d5c01a9c7022003135888c85b3255226e4cf98 Mon Sep 17 00:00:00 2001
|
|
From: Eddie Kohler <ekohler@gmail.com>
|
|
Date: Sun, 8 Apr 2018 15:15:56 -0400
|
|
Subject: [PATCH] Fix #130 (gifdiff null pointer deref).
|
|
|
|
---
|
|
src/gifdiff.c | 10 +++++-----
|
|
1 file changed, 5 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/src/gifdiff.c b/src/gifdiff.c
|
|
index ade1e1e..abc0142 100644
|
|
--- a/src/gifdiff.c
|
|
+++ b/src/gifdiff.c
|
|
@@ -61,9 +61,8 @@ static Clp_Parser* clp;
|
|
static void
|
|
combine_colormaps(Gif_Colormap *gfcm, Gif_Colormap *newcm)
|
|
{
|
|
- int i;
|
|
- if (!gfcm) return;
|
|
- for (i = 0; i < gfcm->ncol; i++) {
|
|
+ int i, gfcm_ncol = gfcm ? gfcm->ncol : 0;
|
|
+ for (i = 0; i < gfcm_ncol; i++) {
|
|
Gif_Color *c = &gfcm->col[i];
|
|
c->pixel = Gif_AddColor(newcm, c, 1);
|
|
}
|
|
@@ -116,11 +115,12 @@ apply_image(int is_second, Gif_Stream *gfs, int imageno, uint16_t background)
|
|
uint16_t *data = gdata[is_second];
|
|
uint16_t *last = glast[is_second];
|
|
Gif_Colormap *gfcm = gfi->local ? gfi->local : gfs->global;
|
|
+ int gfcm_ncol = gfcm ? gfcm->ncol : 0;
|
|
|
|
/* set up colormap */
|
|
- for (i = 0; i < gfcm->ncol; ++i)
|
|
+ for (i = 0; i < gfcm_ncol; ++i)
|
|
map[i] = gfcm->col[i].pixel;
|
|
- for (i = gfcm->ncol; i < 256; ++i)
|
|
+ for (i = gfcm_ncol; i < 256; ++i)
|
|
map[i] = 1;
|
|
if (gfi->transparent >= 0 && gfi->transparent < 256)
|
|
map[gfi->transparent] = TRANSP;
|