Lucio Andrés Illanes Albornoz e3166d
http://bugs.alpinelinux.org/issues/6132
Lucio Andrés Illanes Albornoz e3166d
https://trac.xiph.org/ticket/2287
Lucio Andrés Illanes Albornoz e3166d
Lucio Andrés Illanes Albornoz e3166d
patch rebased for libtheory 1.1.1 stable
Lucio Andrés Illanes Albornoz e3166d
Lucio Andrés Illanes Albornoz e3166d
diff -ru libtheora-1.1.1.orig/lib/encode.c libtheora-1.1.1/lib/encode.c
Lucio Andrés Illanes Albornoz e3166d
--- libtheora-1.1.1.orig/lib/encode.c	2009-08-22 18:14:04.000000000 +0000
Lucio Andrés Illanes Albornoz e3166d
+++ libtheora-1.1.1/lib/encode.c	2016-09-15 05:27:02.065785527 +0000
Lucio Andrés Illanes Albornoz e3166d
@@ -864,6 +864,9 @@
Lucio Andrés Illanes Albornoz e3166d
 }
Lucio Andrés Illanes Albornoz e3166d
 
Lucio Andrés Illanes Albornoz e3166d
 static void oc_enc_frame_pack(oc_enc_ctx *_enc){
Lucio Andrés Illanes Albornoz e3166d
+  /*musl libc malloc()/realloc() calls might use floating point, so make sure
Lucio Andrés Illanes Albornoz e3166d
+     we've cleared the MMX state for them.*/
Lucio Andrés Illanes Albornoz e3166d
+  oc_restore_fpu(&_enc->state);
Lucio Andrés Illanes Albornoz e3166d
   oggpackB_reset(&_enc->opb);
Lucio Andrés Illanes Albornoz e3166d
   /*Only proceed if we have some coded blocks.
Lucio Andrés Illanes Albornoz e3166d
     If there are no coded blocks, we can drop this frame simply by emitting a
Lucio Andrés Illanes Albornoz e3166d
diff -ru libtheora-1.1.1.orig/lib/decode.c libtheora-1.1.1/lib/decode.c
Lucio Andrés Illanes Albornoz e3166d
--- libtheora-1.1.1.orig/lib/decode.c	2009-09-26 20:55:21.000000000 +0000
Lucio Andrés Illanes Albornoz e3166d
+++ libtheora-1.1.1/lib/decode.c	2016-09-15 05:29:45.912196850 +0000
Lucio Andrés Illanes Albornoz e3166d
@@ -1181,6 +1181,9 @@
Lucio Andrés Illanes Albornoz e3166d
 
Lucio Andrés Illanes Albornoz e3166d
 
Lucio Andrés Illanes Albornoz e3166d
 static int oc_dec_postprocess_init(oc_dec_ctx *_dec){
Lucio Andrés Illanes Albornoz e3166d
+  /*musl libc malloc()/realloc() calls might use floating point, so make sure
Lucio Andrés Illanes Albornoz e3166d
+     we've cleared the MMX state for them.*/
Lucio Andrés Illanes Albornoz e3166d
+  oc_restore_fpu(&_dec->state);
Lucio Andrés Illanes Albornoz e3166d
   /*pp_level 0: disabled; free any memory used and return*/
Lucio Andrés Illanes Albornoz e3166d
   if(_dec->pp_level<=OC_PP_LEVEL_DISABLED){
Lucio Andrés Illanes Albornoz e3166d
     if(_dec->dc_qis!=NULL){