Benjamin Otte
2007-Feb-08 04:55 UTC
[Swfdec] 3 commits - libswfdec/swfdec_loader.c libswfdec/swfdec_script.c libswfdec/swfdec_video.c
libswfdec/swfdec_loader.c | 21 +++++++++++++++------ libswfdec/swfdec_script.c | 7 ++++++- libswfdec/swfdec_video.c | 23 ++++++++++++++++------- 3 files changed, 37 insertions(+), 14 deletions(-) New commits: diff-tree e066302f8172f17b68430c6b428a386c41c516c4 (from 39a3a07397847fe45e2c2ef1f1c1b343bfd1690a) Author: Benjamin Otte <otte@gnome.org> Date: Thu Feb 8 13:28:04 2007 +0100 Make the filename be the part of the uri that sits before the first '?' and does not contain a '/' diff --git a/libswfdec/swfdec_loader.c b/libswfdec/swfdec_loader.c index 557fa1c..756e174 100644 --- a/libswfdec/swfdec_loader.c +++ b/libswfdec/swfdec_loader.c @@ -365,19 +365,28 @@ swfdec_loader_eof (SwfdecLoader *loader) char * swfdec_loader_get_filename (SwfdecLoader *loader) { - char *start, *ret; + char *start, *end, *ret; g_return_val_if_fail (SWFDEC_IS_LOADER (loader), NULL); /* every loader must set this */ g_return_val_if_fail (loader->url != NULL, NULL); - start = strrchr (loader->url, '/'); - if (start == NULL) { - start = loader->url; + end = strchr (loader->url, '?'); + if (end) { + char *next = NULL; + do { + start = next ? next + 1 : loader->url; + next = strchr (start, '/'); + } while (next != NULL && next < end); } else { - start++; + start = strrchr (loader->url, '/'); + if (start == NULL) { + start = loader->url; + } else { + start++; + } } - ret = g_filename_from_utf8 (start, -1, NULL, NULL, NULL); + ret = g_filename_from_utf8 (start, end ? end - start : -1, NULL, NULL, NULL); if (ret == NULL) ret = g_strdup ("unknown.swf"); diff-tree 39a3a07397847fe45e2c2ef1f1c1b343bfd1690a (from f95a7844826c8edf6e0d9edda090cf89d72b9d7f) Author: Benjamin Otte <otte@gnome.org> Date: Thu Feb 8 12:42:53 2007 +0100 Fix crash when trying to use a video stream of a placeholder If the video is supposed to be loaded via netstream, a placeholder object is created. Don't play if this is detected. Also don't play if the video uses an unsupported codec. diff --git a/libswfdec/swfdec_video.c b/libswfdec/swfdec_video.c index 7d89860..867259c 100644 --- a/libswfdec/swfdec_video.c +++ b/libswfdec/swfdec_video.c @@ -130,14 +130,20 @@ swfdec_video_input_new (SwfdecVideo *vid { SwfdecVideoInput *input = g_new0 (SwfdecVideoInput, 1); + if (video->n_frames == 0) + return NULL; + if (video->codec == NULL) + return NULL; + if (video->codec) + input->decoder = swfdec_video_codec_init (video->codec); + if (input->decoder == NULL) + return NULL; input->input.get_image = swfdec_video_input_get_image; input->input.iterate = swfdec_video_input_iterate; input->input.finalize = swfdec_video_input_finalize; g_object_ref (video); input->video = video; input->current_frame = (guint) -1; - if (video->codec) - input->decoder = swfdec_video_codec_init (video->codec); return &input->input; } @@ -154,7 +160,8 @@ swfdec_video_create_movie (SwfdecGraphic movie->video = SWFDEC_VIDEO (graphic); g_object_ref (graphic); - swfdec_video_movie_set_input (movie, input); + if (input) + swfdec_video_movie_set_input (movie, input); return SWFDEC_MOVIE (movie); } @@ -213,10 +220,12 @@ tag_func_define_video (SwfdecSwfDecoder SWFDEC_LOG (" deblocking: %d", deblocking); SWFDEC_LOG (" smoothing: %d", smoothing); SWFDEC_LOG (" format: %d", (int) video->format); - video->codec = swfdec_codec_get_video (video->format); - if (video->codec == NULL) { - SWFDEC_WARNING ("no codec for format %d", (int) video->format); - return SWFDEC_STATUS_OK; + if (video->format != SWFDEC_VIDEO_FORMAT_UNDEFINED) { + video->codec = swfdec_codec_get_video (video->format); + if (video->codec == NULL) { + SWFDEC_WARNING ("no codec for format %d", (int) video->format); + return SWFDEC_STATUS_OK; + } } return SWFDEC_STATUS_OK; } diff-tree f95a7844826c8edf6e0d9edda090cf89d72b9d7f (from 998ea3e494c4d6f2d798085b3df1e4da07b18a68) Author: Benjamin Otte <otte@gnome.org> Date: Thu Feb 8 12:16:23 2007 +0100 fix potential segfault when DefineFunction is called inside DefineFunction the problem is that constant pools may refer to the outermost function which the old code asserted would not be possible. diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index c416f64..74b9934 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -109,7 +109,12 @@ swfdec_constant_pool_get_area (SwfdecScr return NULL; start = (guint8 *) g_ptr_array_index (pool, 0) - 5; buffer = script->buffer; - g_assert (start >= buffer->data); + if (start < buffer->data) { + /* DefineFunction inside DefineFunction */ + g_assert (buffer->parent != NULL); + buffer = buffer->parent; + g_assert (start >= buffer->data); + } g_assert (start + 3 < buffer->data + buffer->length); g_assert (*start == 0x88); len = 3 + (start[1] | start[2] << 8);
Apparently Analagous Threads
- 4 commits - libswfdec/swfdec_audio_flv.c libswfdec/swfdec_audio_stream.c libswfdec/swfdec_codec_adpcm.c libswfdec/swfdec_codec.c libswfdec/swfdec_codec_ffmpeg.c libswfdec/swfdec_codec_gst.c libswfdec/swfdec_codec.h libswfdec/swfdec_codec_mad.c
- 3 commits - libswfdec-gtk/swfdec_gtk_loader.c libswfdec/Makefile.am libswfdec/swfdec_codec.c libswfdec/swfdec_codec_ffmpeg.c libswfdec/swfdec_codec_gst.c libswfdec/swfdec_codec.h libswfdec/swfdec_codec_screen.c libswfdec/swfdec_codec_video.c
- 11 commits - libswfdec-gtk/swfdec_gtk_loader.c libswfdec-gtk/swfdec_playback_alsa.c libswfdec-gtk/swfdec_source.c libswfdec/swfdec_cached.c libswfdec/swfdec_font.c libswfdec/swfdec_morphshape.c libswfdec/swfdec_net_stream.c libswfdec/swfdec_script.c
- 12 commits - libswfdec/Makefile.am libswfdec/swfdec_audio_flv.c libswfdec/swfdec_flv_decoder.c libswfdec/swfdec_js.c libswfdec/swfdec_js.h libswfdec/swfdec_js_video.c libswfdec/swfdec_loader.c libswfdec/swfdec_loader_internal.h
- Changes to 'refs/tags/0.4.2'