]> git.imager.perl.org - imager.git/blobdiff - Imager.xs
avoid re-entrancy into giflib using the mutex API
[imager.git] / Imager.xs
index 13b53532017721367d4428ed1903f3dfa2563f56..e9e6351997e93485c3e6eb4f76bdb8943feff61f 100644 (file)
--- a/Imager.xs
+++ b/Imager.xs
@@ -2097,6 +2097,10 @@ i_convert(src, avmain)
              if (len > inchan)
                inchan = len;
            }
+           else {
+             i_push_errorf(0, "invalid matrix: element %d is not an array ref", j);
+             XSRETURN(0);
+           }
           }
           coeff = mymalloc(sizeof(double) * outchan * inchan);
          for (j = 0; j < outchan; ++j) {
@@ -4062,8 +4066,8 @@ im_context_DESTROY(ctx)
 void
 im_context_CLONE(...)
     CODE:
-      (void)items;
       MY_CXT_CLONE;
+      (void)items;
       /* the following sv_setref_pv() will free this inc */
       im_context_refinc(MY_CXT.ctx, "CLONE");
       MY_CXT.ctx = im_context_clone(MY_CXT.ctx, "CLONE");
@@ -4074,9 +4078,11 @@ im_context_CLONE(...)
 BOOT:
         PERL_SET_GLOBAL_CALLBACKS;
        PERL_PL_SET_GLOBAL_CALLBACKS;
+#ifdef PERL_IMPLICIT_CONTEXT
        {
           MY_CXT_INIT;
          (void)MY_CXT;
        }
+#endif
        start_context(aTHX);
        im_get_context = perl_get_context;