[Swfdec] Branch 'as' - 3 commits - libswfdec/swfdec_bits.c
Benjamin Otte
company at kemper.freedesktop.org
Wed Jul 11 07:41:53 PDT 2007
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);
More information about the Swfdec
mailing list