Benjamin Otte
2007-Jul-11 14:41 UTC
[Swfdec] Branch 'as' - 3 commits - libswfdec/swfdec_bits.c
libswfdec/swfdec_bits.c | 40 ++++++++++++++--------------------------
1 files changed, 14 insertions(+), 26 deletions(-)
New commits:
diff-tree dfcd46a62e9f98d291d4fe80187a1bed1b7a7212 (from parents)
Merge: 4284f9fa4bd2608ca0abca3fad88dd13e8e5370c
0890f620c6b0a312176525a5f0977ed95b5314fe
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Jul 11 16:41:51 2007 +0200
Merge branch 'master' into as
Conflicts:
libswfdec/swfdec_movie.c
diff-tree 0890f620c6b0a312176525a5f0977ed95b5314fe (from
df8e44d9c530cc042e791cde0786cbea30afa373)
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Jul 11 16:41:01 2007 +0200
don't access memory unaligned (fixes #11492)
Hopefully fixes it...
diff --git a/libswfdec/swfdec_bits.c b/libswfdec/swfdec_bits.c
index c8a5062..8ec6936 100644
--- a/libswfdec/swfdec_bits.c
+++ b/libswfdec/swfdec_bits.c
@@ -307,11 +307,9 @@ swfdec_bits_get_float (SwfdecBits * b)
SWFDEC_BYTES_CHECK (b, 4);
- conv.i = *((gint32 *) b->ptr);
+ conv.i = (b->ptr[3] << 24) | (b->ptr[2] << 16) |
(b->ptr[1] << 8) | b->ptr[0];
b->ptr += 4;
- conv.i = GINT32_FROM_LE (conv.i);
-
return conv.f;
}
@@ -323,40 +321,30 @@ swfdec_bits_get_float (SwfdecBits * b)
* use this command line:
* python -c "import struct; print struct.unpack('8c',
struct.pack('d', 7.949928895127363e-275))"
*/
-static double
-swfdec_bits_double_to_host (double in)
+double
+swfdec_bits_get_double (SwfdecBits * b)
{
union {
guint32 i[2];
double d;
} conv;
- conv.d = in;
+ SWFDEC_BYTES_CHECK (b, 8);
+
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
- {
- int tmp = conv.i[0];
- conv.i[0] = conv.i[1];
- conv.i[1] = tmp;
- }
+ conv.i[1] = (b->ptr[3] << 24) | (b->ptr[2] << 16) |
(b->ptr[1] << 8) | b->ptr[0];
+ conv.i[0] = (b->ptr[7] << 24) | (b->ptr[6] << 16) |
(b->ptr[5] << 8) | b->ptr[4];
#else
- conv.i[0] = GUINT32_FROM_LE (conv.i[0]);
- conv.i[1] = GUINT32_FROM_LE (conv.i[1]);
+ conv.i[0] = (b->ptr[3] << 24) | (b->ptr[2] << 16) |
(b->ptr[1] << 8) | b->ptr[0];
+ conv.i[1] = (b->ptr[7] << 24) | (b->ptr[6] << 16) |
(b->ptr[5] << 8) | b->ptr[4];
+#if 0
+ conv.i[0] = (b->ptr[0] << 24) | (b->ptr[1] << 16) |
(b->ptr[2] << 8) | b->ptr[3];
+ conv.i[1] = (b->ptr[4] << 24) | (b->ptr[5] << 16) |
(b->ptr[6] << 8) | b->ptr[7];
+#endif
#endif
- return conv.d;
-}
-
-double
-swfdec_bits_get_double (SwfdecBits * b)
-{
- double d;
-
- SWFDEC_BYTES_CHECK (b, 8);
-
- d = *((double *) b->ptr);
b->ptr += 8;
- d = swfdec_bits_double_to_host (d);
- return d;
+ return conv.d;
}
double
diff-tree df8e44d9c530cc042e791cde0786cbea30afa373 (from
f1b1b9d2d998bcc19cbd915b58a7f3d63a435a6b)
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Jul 11 15:57:49 2007 +0200
fix segfault when rotation isn't a finite value
diff --git a/libswfdec/swfdec_movie.c b/libswfdec/swfdec_movie.c
index 53b47c2..5bde15a 100644
--- a/libswfdec/swfdec_movie.c
+++ b/libswfdec/swfdec_movie.c
@@ -143,8 +143,10 @@ swfdec_movie_update_matrix (SwfdecMovie
d = movie->xscale / swfdec_matrix_get_xscale
(&movie->content->transform);
e = movie->yscale / swfdec_matrix_get_yscale
(&movie->content->transform);
cairo_matrix_scale (&movie->matrix, d, e);
- d = movie->rotation - swfdec_matrix_get_rotation
(&movie->content->transform);
- cairo_matrix_rotate (&movie->matrix, d * G_PI / 180);
+ if (finite (movie->rotation)) {
+ d = movie->rotation - swfdec_matrix_get_rotation
(&movie->content->transform);
+ cairo_matrix_rotate (&movie->matrix, d * G_PI / 180);
+ }
swfdec_matrix_ensure_invertible (&movie->matrix,
&movie->inverse_matrix);
swfdec_movie_update_extents (movie);
Reasonably Related Threads
- libswfdec/swfdec_bits.c
- libswfdec/swfdec_movie.c
- Branch 'as' - 4 commits - libswfdec/swfdec_color.c libswfdec/swfdec_movie_asprops.c libswfdec/swfdec_movie.c test/trace
- 3 commits - libswfdec/swfdec_bits.c libswfdec/swfdec_bits.h libswfdec/swfdec_sprite.c libswfdec/swfdec_tag.c
- libswfdec-gtk/swfdec_playback_alsa.c libswfdec/swfdec_audio_event.h libswfdec/swfdec_audio_flv.h libswfdec/swfdec_audio_stream.h libswfdec/swfdec_bits.c libswfdec/swfdec_bits.h libswfdec/swfdec_buffer.c libswfdec/swfdec_buffer.h libswfdec/swfdec_cache.c
