Bug in jit.mxform2d inside jit.expr?
Hi,
I think there is a bug in jit.mxform2d when instantiated inside jit.expr, when "c" mxform parameter is negative. See attached patch. Tested in Max 6 & 7.
Thanks for letting me know if the error is in the patch.
There is also a similar bug when "b" parameter is negative. See this second patch:
There is also a bug for mxform parameters "u" and "v":
Patch for "u":
Patch for "v":
Variation on the same theme, this time with a systematic crash. Mac OS 10.9.5.
It looks like this instant crash feature has to do not only with the mentioned params being negative, but also with the interp attribute: the following patch gives you an instant crash only with interp 1:
Even cleaner: immediate crash on Max 6 & 7 with the default mxform parameters. In the patch below, see how to fix the crash either by changing a parameter, or by changing the interp mode.
Impressive report ;-)
I can repro here and we will take a look. Another data point, it only crashes with matricies of certain sizes.
-Ben
I mentioned a bug with mxform2d in jit.expr in 2007: https://cycling74.com/forums/bug-in-jit-expr-with-functor-jit-mxform2d/
The post text disappeared, but here is the patch I sent at the time. I don't have the original steps to reproduce, but you'll see the bug if you do the following:
- create a new empty patch (Max 4.6, 5, 6 or 7)
- paste the patch below
- double-click the [loadbang] object
- click the "chilis.jpg" message box
- click the [button] to output the matrix
- see, the image is the same on left & right
- now, set the "u" value to -0.1 (negative value)
- hit the [button] again
- see, image on the right is correct, nothing shows up on the left, when jit.mxform2d is instantiated by jit.expr.
- plus you may get a crash after all: not immediately, but when you close the patch (Max 6 or 7)
max v2;
#N vpatcher 201 121 1209 736;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 473 121 20 196617 w;
#P comment 401 121 20 196617 tx;
#P comment 437 121 20 196617 ty;
#P comment 365 121 14 196617 v;
#P comment 293 121 14 196617 c;
#P comment 329 121 14 196617 d;
#P comment 257 121 14 196617 u;
#P comment 185 121 14 196617 a;
#P button 43 42 15 0;
#P newex 179 269 69 196617 prepend expr;
#P message 333 68 14 196617 2;
#P message 299 68 14 196617 0;
#P message 272 68 14 196617 1;
#P newex 299 39 48 196617 loadbang;
#P user jit.pwindow 552 388 202 152 0 1 0 0 1 0;
#P user jit.pwindow 178 388 202 152 0 1 0 0 1 0;
#P window linecount 5;
#P message 266 318 188 196617 expr "jit.mxform2d(in[0]\\\, @mxform 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 1.000000\\\, @interp 0\\\, @boundmode 2)";
#P window linecount 1;
#P newex 43 133 27 196617 t l b;
#P newex 553 250 177 196617 pack mxform 0. 0. 0. 0. 0. 0. 0. 0. 0.;
#P message 816 250 71 196617 boundmode \$1;
#P message 748 250 50 196617 interp \$1;
#P toggle 512 134 15 0;
#P message 62 42 74 196617 read chilis.jpg;
#P newex 43 79 111 196617 jit.qt.movie 600 2000;
#P newex 553 311 71 196617 jit.mxform2d;
#P newex 266 299 62 196617 prepend set;
#P newex 179 311 45 196617 jit.expr;
#P number 537 134 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 467 134 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 431 134 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 395 134 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 359 134 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 323 134 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 287 134 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 251 134 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 215 134 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 179 134 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 359 161 45 196617 * 0.001;
#P newex 251 160 45 196617 * 0.001;
#P window linecount 2;
#P newex 179 237 284 196617 sprintf symout jit.mxform2d(in[0]\\\\\\\, @mxform %f %f %f %f %f %f %f %f %f\\\\\\\, @interp %i\\\\\\\, @boundmode %i);
#P window linecount 1;
#P comment 221 121 14 196617 b;
#P connect 32 0 17 0;
#P fasten 18 0 17 0 67 71 48 71;
#P connect 17 0 23 0;
#P fasten 28 0 4 0 277 102 184 102;
#P connect 4 0 1 0;
#P fasten 23 1 1 0 65 222 184 222;
#P lcolor 7;
#P connect 1 0 31 0;
#P fasten 23 0 14 0 48 310 184 310;
#P lcolor 7;
#P connect 31 0 14 0;
#P connect 14 0 25 0;
#P connect 5 0 1 1;
#P fasten 29 0 5 0 304 108 220 108;
#P connect 2 0 1 2;
#P fasten 29 0 6 0 304 108 256 108;
#P connect 6 0 2 0;
#P connect 7 0 1 3;
#P connect 31 0 15 0;
#P connect 15 0 24 0;
#P connect 27 0 28 0;
#P fasten 29 0 7 0 304 108 292 108;
#P connect 8 0 1 4;
#P connect 27 0 29 0;
#P connect 3 0 1 5;
#P fasten 28 0 8 0 277 102 328 102;
#P connect 27 0 30 0;
#P connect 10 0 1 6;
#P fasten 29 0 9 0 304 108 364 108;
#P connect 9 0 3 0;
#P connect 11 0 1 7;
#P fasten 29 0 10 0 304 108 400 108;
#P connect 12 0 1 8;
#P connect 19 0 1 9;
#P fasten 29 0 11 0 304 108 436 108;
#P connect 13 0 1 10;
#P fasten 28 0 12 0 277 102 472 102;
#P fasten 29 0 19 0 304 108 517 108;
#P fasten 30 0 13 0 338 96 542 96;
#P fasten 23 1 22 0 65 211 558 211;
#P lcolor 7;
#P connect 21 0 16 0;
#P connect 20 0 16 0;
#P connect 22 0 16 0;
#P fasten 23 0 16 0 48 293 558 293;
#P lcolor 7;
#P connect 16 0 26 0;
#P connect 4 0 22 1;
#P connect 5 0 22 2;
#P connect 2 0 22 3;
#P connect 7 0 22 4;
#P connect 8 0 22 5;
#P connect 3 0 22 6;
#P connect 10 0 22 7;
#P connect 11 0 22 8;
#P connect 12 0 22 9;
#P connect 19 0 20 0;
#P connect 13 0 21 0;
#P pop;