Log in

View Full Version : Fixes to the type matcher


stickboy
29th March 2004, 13:26
I've been poking around in the AviSynth source to try to fix that pesky problem with *s in plug-in parameter strings. (For anyone not aware, for most cases the * modifier wasn't accepting zero matches. As a consequence, AviSynth didn't allow Animate/ApplyRange to be used with filters that take no arguments, nor did it allow SelectEvery(n) (which is supposed to be equivalent to SelectEvery(n, 0)).)

AFAICT, the following quick-fix seems to work:

In TypeMatch in avisynth.cpp, I changed:return ( *param_types == 0 || *param_types == '['
|| *param_types == '+' || *param_types == '*');
to:
return *param_types == '\0' || *param_types == '['
|| *param_types == '+' || param_types[0] == '*' || param_types[1] == '*';Yeah, it seems like a hack; I haven't noticed any problems so far, but this is certainly the type of change that ought to undergo more scrutiny. Can anyone think of any cases this change might break?

I also modified AddFunction to check the correctness of filters' parameter strings.

TypeMatchTest.zip (http://www.avisynth.org/stickboy/tmp/TypeMatchTest.zip) contains a modified avisynth.cpp (based on a version I checked out of CVS a few hours ago) along with a really basic command-line test harness for TypeMatch.

sh0dan
30th March 2004, 08:58
Seems like a nice change. I'll add it to CVS.

Have you experienced any filters with invalid parameters?

stickboy
30th March 2004, 09:40
Originally posted by sh0dan
Have you experienced any filters with invalid parameters?No, but I think it's useful:
It can simplify or eliminate error-checks in TypeMatch
I think there are some bogus parameter strings that could cause TypeMatch (and maybe other functions) to read beyond the end of the parameter string. There also are some that TypeMatch accepts (e.g. consecutive *s and +s) that potentially could cause less detectable problems.
Doesn't hurt. :)

sh0dan
30th March 2004, 14:38
Doesn't hurt.
Actually it does. :(

I have ImageSequence.dll in my plugin dir, and it contains invalid parameters. Since vdubmod scans available plugins, this leads to a crash on every vdubmod startup.

Since it is not as carefully checked, vdubmod simply doesn't start up, but bombs out.

So no go. At least for default implementations. :(

WarpEnterprises
30th March 2004, 16:03
why does IS not work and which version is causing this?

stickboy
30th March 2004, 21:53
Hmm... I just tried ImageSequence.dll from Imagesequence_25_dll_20030507.zip, and it seems to load fine for me. I don't see anything wrong with its parameter string either.