Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 457652
Collapse All | Expand All

(-)configure~ (-2 / +4 lines)
Lines 4966-4974 Link Here
4966
#include <gif_lib.h>
4966
#include <gif_lib.h>
4967
static void catch(int sig) { exit(1); }
4967
static void catch(int sig) { exit(1); }
4968
int main(void) {
4968
int main(void) {
4969
  GifFileType type;
4970
4969
  signal(SIGSEGV, catch);  // catch segfault
4971
  signal(SIGSEGV, catch);  // catch segfault
4970
  printf("EGifPutExtensionFirst is at address %p\n", EGifPutExtensionFirst);
4972
  printf("EGifPutExtensionLeader is at address %p\n", EGifPutExtensionLeader);
4971
  EGifSetGifVersion("89a");   // this will segfault a buggy gif lib.
4973
  EGifSetGifVersion(&type, true);   // this will segfault a buggy gif lib.
4972
  return 0;
4974
  return 0;
4973
}
4975
}
4974
EOF
4976
EOF
(-)libvo/vo_gif89a.c.orig (+22 lines)
Lines 44-51 Link Here
44
 * entire argument being interpretted as the filename.
44
 * entire argument being interpretted as the filename.
45
 */
45
 */
46
46
47
#include <sys/types.h>
47
#include <gif_lib.h>
48
#include <gif_lib.h>
48
49
50
#if GIFLIB_MAJOR >= 5
51
#define MakeMapObject GifMakeMapObject
52
#define FreeMapObject GifFreeMapObject
53
#define QuantizeBuffer GifQuantizeBuffer
54
#endif
55
49
#include <stdio.h>
56
#include <stdio.h>
50
#include <stdlib.h>
57
#include <stdlib.h>
51
#include <string.h>
58
#include <string.h>
Lines 189-207 Link Here
189
	// earlier versions of libungif.  i don't know exactly which,
196
	// earlier versions of libungif.  i don't know exactly which,
190
	// but certainly in all those before v4.  if you have problems,
197
	// but certainly in all those before v4.  if you have problems,
191
	// you need to upgrade your gif library.
198
	// you need to upgrade your gif library.
199
#if GIFLIB_MAJOR < 5
192
#ifdef CONFIG_GIF_4
200
#ifdef CONFIG_GIF_4
193
	EGifSetGifVersion("89a");
201
	EGifSetGifVersion("89a");
194
#else
202
#else
195
	mp_msg(MSGT_VO, MSGL_ERR, "GIF89a: Your version of libungif needs to be upgraded.\n");
203
	mp_msg(MSGT_VO, MSGL_ERR, "GIF89a: Your version of libungif needs to be upgraded.\n");
196
	mp_msg(MSGT_VO, MSGL_ERR, "GIF89a: Some functionality has been disabled.\n");
204
	mp_msg(MSGT_VO, MSGL_ERR, "GIF89a: Some functionality has been disabled.\n");
197
#endif
205
#endif
206
#endif
198
207
208
#if GIFLIB_MAJOR >= 5
209
	new_gif = EGifOpenFileName(gif_filename, 0, NULL);
210
#else
199
	new_gif = EGifOpenFileName(gif_filename, 0);
211
	new_gif = EGifOpenFileName(gif_filename, 0);
212
#endif
200
	if (new_gif == NULL) {
213
	if (new_gif == NULL) {
201
		mp_msg(MSGT_VO, MSGL_ERR, "GIF89a: error opening file \"%s\" for output.\n", gif_filename);
214
		mp_msg(MSGT_VO, MSGL_ERR, "GIF89a: error opening file \"%s\" for output.\n", gif_filename);
202
		return 1;
215
		return 1;
203
	}
216
	}
204
217
218
#if GIFLIB_MAJOR >= 5
219
	EGifSetGifVersion(new_gif, true);
220
#endif
221
205
	slice_data = malloc(img_width * img_height * 3);
222
	slice_data = malloc(img_width * img_height * 3);
206
	if (slice_data == NULL) {
223
	if (slice_data == NULL) {
207
		mp_msg(MSGT_VO, MSGL_ERR, "GIF89a: malloc failed.\n");
224
		mp_msg(MSGT_VO, MSGL_ERR, "GIF89a: malloc failed.\n");
Lines 235-243 Link Here
235
	// version 3 of libungif does not support multiple control blocks.
252
	// version 3 of libungif does not support multiple control blocks.
236
	// looping requires multiple control blocks.
253
	// looping requires multiple control blocks.
237
	// therefore, looping is only enabled for v4 and up.
254
	// therefore, looping is only enabled for v4 and up.
255
#if GIFLIB_MAJOR >= 5
256
	EGifPutExtension(new_gif, 0xFF, 11, LB1);
257
	EGifPutExtension(new_gif, 0, 3, LB2);
258
#else
238
	EGifPutExtensionFirst(new_gif, 0xFF, 11, LB1);
259
	EGifPutExtensionFirst(new_gif, 0xFF, 11, LB1);
239
	EGifPutExtensionLast(new_gif, 0, 3, LB2);
260
	EGifPutExtensionLast(new_gif, 0, 3, LB2);
240
#endif
261
#endif
262
#endif
241
263
242
	mp_msg(MSGT_VO, MSGL_DBG2, "GIF89a: Config finished.\n");
264
	mp_msg(MSGT_VO, MSGL_DBG2, "GIF89a: Config finished.\n");
243
	return 0;
265
	return 0;
(-)libmpdemux/demux_gif.c.orig (-7 / +42 lines)
Lines 53-58 Link Here
53
}
53
}
54
#endif
54
#endif
55
55
56
#if GIFLIB_MAJOR >= 5
57
static void PrintGifErrorStr(char *str)
58
{
59
  fprintf(stderr, "Error in GIF library: %s\n", str);
60
}
61
62
static void PrintGifError(int errorCode)
63
{
64
  PrintGifErrorStr(GifErrorString(errorCode));
65
}
66
#endif
67
56
static int gif_check_file(demuxer_t *demuxer)
68
static int gif_check_file(demuxer_t *demuxer)
57
{
69
{
58
  if (stream_read_int24(demuxer->stream) == GIF_SIGNATURE)
70
  if (stream_read_int24(demuxer->stream) == GIF_SIGNATURE)
Lines 94-107 Link Here
94
106
95
  while (type != IMAGE_DESC_RECORD_TYPE) {
107
  while (type != IMAGE_DESC_RECORD_TYPE) {
96
    if (DGifGetRecordType(gif, &type) == GIF_ERROR) {
108
    if (DGifGetRecordType(gif, &type) == GIF_ERROR) {
109
#if GIFLIB_MAJOR < 5
97
      PrintGifError();
110
      PrintGifError();
111
#else
112
      PrintGifError(gif->Error);
113
#endif
98
      return 0; // oops
114
      return 0; // oops
99
    }
115
    }
100
    if (type == TERMINATE_RECORD_TYPE)
116
    if (type == TERMINATE_RECORD_TYPE)
101
      return 0; // eof
117
      return 0; // eof
102
    if (type == SCREEN_DESC_RECORD_TYPE) {
118
    if (type == SCREEN_DESC_RECORD_TYPE) {
103
      if (DGifGetScreenDesc(gif) == GIF_ERROR) {
119
      if (DGifGetScreenDesc(gif) == GIF_ERROR) {
104
        PrintGifError();
120
        PrintGifError(gif->Error);
105
        return 0; // oops
121
        return 0; // oops
106
      }
122
      }
107
    }
123
    }
Lines 109-115 Link Here
109
      int code;
125
      int code;
110
      unsigned char *p = NULL;
126
      unsigned char *p = NULL;
111
      if (DGifGetExtension(gif, &code, &p) == GIF_ERROR) {
127
      if (DGifGetExtension(gif, &code, &p) == GIF_ERROR) {
112
        PrintGifError();
128
        PrintGifError(gif->Error);
113
        return 0; // oops
129
        return 0; // oops
114
      }
130
      }
115
      if (code == 0xF9) {
131
      if (code == 0xF9) {
Lines 138-144 Link Here
138
	  comments[length] = 0;
154
	  comments[length] = 0;
139
	  printf("%s", comments);
155
	  printf("%s", comments);
140
          if (DGifGetExtensionNext(gif, &p) == GIF_ERROR) {
156
          if (DGifGetExtensionNext(gif, &p) == GIF_ERROR) {
141
            PrintGifError();
157
            PrintGifError(gif->Error);
142
            return 0; // oops
158
            return 0; // oops
143
          }
159
          }
144
	}
160
	}
Lines 146-152 Link Here
146
      }
162
      }
147
      while (p != NULL) {
163
      while (p != NULL) {
148
        if (DGifGetExtensionNext(gif, &p) == GIF_ERROR) {
164
        if (DGifGetExtensionNext(gif, &p) == GIF_ERROR) {
149
          PrintGifError();
165
          PrintGifError(gif->Error);
150
          return 0; // oops
166
          return 0; // oops
151
        }
167
        }
152
      }
168
      }
Lines 154-160 Link Here
154
  }
170
  }
155
171
156
  if (DGifGetImageDesc(gif) == GIF_ERROR) {
172
  if (DGifGetImageDesc(gif) == GIF_ERROR) {
157
    PrintGifError();
173
    PrintGifError(gif->Error);
158
    return 0; // oops
174
    return 0; // oops
159
  }
175
  }
160
176
Lines 167-173 Link Here
167
    memset(dp->buffer, gif->SBackGroundColor, priv->w * priv->h);
183
    memset(dp->buffer, gif->SBackGroundColor, priv->w * priv->h);
168
184
169
  if (DGifGetLine(gif, buf, len) == GIF_ERROR) {
185
  if (DGifGetLine(gif, buf, len) == GIF_ERROR) {
170
    PrintGifError();
186
    PrintGifError(gif->Error);
171
    free(buf);
187
    free(buf);
172
    return 0; // oops
188
    return 0; // oops
173
  }
189
  }
Lines 241-246 Link Here
241
  gif_priv_t *priv = calloc(1, sizeof(gif_priv_t));
257
  gif_priv_t *priv = calloc(1, sizeof(gif_priv_t));
242
  sh_video_t *sh_video = NULL;
258
  sh_video_t *sh_video = NULL;
243
  GifFileType *gif = NULL;
259
  GifFileType *gif = NULL;
260
#if GIFLIB_MAJOR >= 5
261
  int error = 0;
262
#endif
244
263
245
  priv->current_pts = 0;
264
  priv->current_pts = 0;
246
  demuxer->seekable = 0; // FIXME
265
  demuxer->seekable = 0; // FIXME
Lines 257-269 Link Here
257
  lseek(demuxer->stream->fd, 0, SEEK_SET);
276
  lseek(demuxer->stream->fd, 0, SEEK_SET);
258
  gif = DGifOpenFileHandle(demuxer->stream->fd);
277
  gif = DGifOpenFileHandle(demuxer->stream->fd);
259
#else
278
#else
279
#if GIFLIB_MAJOR < 5
260
  gif = DGifOpen(demuxer->stream, my_read_gif);
280
  gif = DGifOpen(demuxer->stream, my_read_gif);
261
#endif
281
262
  if (!gif) {
282
  if (!gif) {
263
    PrintGifError();
283
    PrintGifError();
264
    free(priv);
284
    free(priv);
265
    return NULL;
285
    return NULL;
266
  }
286
  }
287
#else
288
289
  gif = DGifOpen(demuxer->stream, my_read_gif, &error);
290
  
291
  if (error) {
292
    PrintGifError(error);
293
    free(priv);
294
    return NULL;
295
  }
296
#endif
297
#endif
267
298
268
  // create a new video stream header
299
  // create a new video stream header
269
  sh_video = new_sh_video(demuxer, 0);
300
  sh_video = new_sh_video(demuxer, 0);
Lines 302-308 Link Here
302
  gif_priv_t *priv = demuxer->priv;
333
  gif_priv_t *priv = demuxer->priv;
303
  if (!priv) return;
334
  if (!priv) return;
304
  if (priv->gif && DGifCloseFile(priv->gif) == GIF_ERROR)
335
  if (priv->gif && DGifCloseFile(priv->gif) == GIF_ERROR)
336
#if GIFLIB_MAJOR < 5
305
    PrintGifError();
337
    PrintGifError();
338
#else
339
    PrintGifError(priv->gif->Error);
340
#endif
306
  free(priv->refimg);
341
  free(priv->refimg);
307
  free(priv);
342
  free(priv);
308
}
343
}

Return to bug 457652