~siretart/xine-lib/ubuntu

« back to all changes in this revision

Viewing changes to src/demuxers/demux_image.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2005-12-15 13:13:45 UTC
  • mfrom: (0.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051215131345-8n4osv1j7fy9c1s1
* SECURITY UPDATE: Fix arbitrary code execution with crafted PNG images in
  embedded ffmpeg copy.
* src/libffmpeg/libavcodec/utils.c, avcodec_default_get_buffer(): Apply
  upstream patch to fix buffer overflow on decoding of small PIX_FMT_PAL8
  PNG files.
* References:
  CVE-2005-4048
  http://mplayerhq.hu/pipermail/ffmpeg-devel/2005-November/005333.html
  http://www1.mplayerhq.hu/cgi-bin/cvsweb.cgi/ffmpeg/libavcodec/
  utils.c.diff?r1=1.161&r2=1.162&cvsroot=FFMpeg

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2003 the xine project
 
2
 * Copyright (C) 2003-2005 the xine project
3
3
 * 
4
4
 * This file is part of xine, a free video player.
5
5
 * 
19
19
 */
20
20
 
21
21
/*
22
 
 * $Id: demux_image.c,v 1.15.2.1 2005/04/20 17:21:04 mroi Exp $
 
22
 * $Id: demux_image.c,v 1.18 2005/02/13 18:42:49 holstsn Exp $
23
23
 *
24
24
 * image dummy demultiplexer
25
25
 */
51
51
  fifo_buffer_t        *video_fifo;
52
52
  input_plugin_t       *input;
53
53
  int                   status;
 
54
  int                   buf_type;
54
55
} demux_image_t ;
55
56
 
56
57
typedef struct {
64
65
  return this->status;
65
66
}
66
67
 
67
 
static int demux_image_send_chunk (demux_plugin_t *this_gen) {
 
68
static int demux_image_next (demux_plugin_t *this_gen, int preview) {
68
69
  demux_image_t *this = (demux_image_t *) this_gen;
69
70
  buf_element_t *buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
70
71
 
71
72
  buf->content = buf->mem;
72
 
  buf->type = BUF_VIDEO_IMAGE;
 
73
  buf->type = this->buf_type;
73
74
 
74
75
  buf->size = this->input->read (this->input, buf->mem, buf->max_size-1);
75
76
 
76
77
  if (buf->size <= 0) {
77
 
    buf->free_buffer(buf);
78
 
    xine_usec_sleep(250000);
 
78
    buf->size = 0;
 
79
    buf->decoder_flags |= BUF_FLAG_FRAME_END;
 
80
    this->status = DEMUX_FINISHED;
79
81
  } else {
80
 
    lprintf("got %i bytes\n", buf->size);
81
 
    this->video_fifo->put (this->video_fifo, buf);
 
82
    this->status = DEMUX_OK;
82
83
  }
83
 
  this->status = DEMUX_OK;
 
84
  
 
85
  if (preview)
 
86
    buf->decoder_flags = BUF_FLAG_PREVIEW;
 
87
 
 
88
  this->video_fifo->put (this->video_fifo, buf);
 
89
 
84
90
  return this->status;
85
91
}
86
92
 
 
93
static int demux_image_send_chunk (demux_plugin_t *this_gen) {
 
94
  return demux_image_next(this_gen, 0);
 
95
}
 
96
 
87
97
static void demux_image_send_headers (demux_plugin_t *this_gen) {
88
98
  demux_image_t *this = (demux_image_t *) this_gen;
89
99
 
90
100
  this->video_fifo  = this->stream->video_fifo;
91
101
 
 
102
  _x_demux_control_start(this->stream);
 
103
 
 
104
  this->input->seek (this->input, 0, SEEK_SET);
 
105
 
 
106
  /* we can send everything here. this makes image decoder a lot easier */
 
107
  while (demux_image_next(this_gen,1) == DEMUX_OK);
 
108
 
92
109
  this->status = DEMUX_OK;
93
110
 
94
111
  _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, 1);
95
112
  _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 0);
96
 
  
97
 
  this->input->seek (this->input, 0, SEEK_SET);
98
113
}
99
114
 
100
115
static int demux_image_seek (demux_plugin_t *this_gen,
132
147
                                    input_plugin_t *input) {
133
148
 
134
149
  demux_image_t *this;
 
150
  int buf_type = BUF_VIDEO_IMAGE;
135
151
 
136
152
  switch (stream->content_detection_method) {
137
153
 
178
194
  this->demux_plugin.demux_class       = class_gen;
179
195
  
180
196
  this->status = DEMUX_FINISHED;
 
197
  this->buf_type = buf_type;
181
198
 
182
199
  lprintf("opened\n");
183
200
  return &this->demux_plugin;
196
213
}
197
214
 
198
215
static char *get_extensions (demux_class_t *this_gen) {
199
 
  return "png";
 
216
  return "png gif jpg jpeg";
200
217
}
201
218
 
202
219
static char *get_mimetypes (demux_class_t *this_gen) {