pinterf / masktools

MaskTools v2 fork
Other
48 stars 11 forks source link

mt_lut* no error if random string used #15

Closed TbtBI closed 3 years ago

TbtBI commented 3 years ago

Hi,

If something like clip.mt_lut("sadada") is used no error is thrown.

pinterf commented 3 years ago

Well :), I admit it may throw no errors.

TbtBI commented 3 years ago

Expr in such case throw "Cannot convert xxx to float" or something like that. Is it possible to have same behavior with luts too?

pinterf commented 3 years ago

Expr and masktools, they have completely different parser logic, historically masktools version did not recognize unknown keywords/numbers, Expr - backported from VapourSynth - did it right. Probably yes, possible, because mankind landed even on Moon and scripting problems are a bit easier task than this :) Let's keep this ticket open.

realfinder commented 3 years ago

and fun fact, srestore for example has many buggy RPNs (which I did fix but not all peoples use my mods), so fixing this maybe case many scripts like this to not work, so if it done maybe it should be adding new parameter called "RPNDebug"

pinterf commented 3 years ago

It is better to throw an error because it is never good to rely on an undefined garbage.

pinterf commented 3 years ago

Lut syntax check is a more tough task. The fix should detect not only unidentifiable keywords but must check for unbalanced expression tree as well. Which results in stack overflow/underflow inside. Spent days on it, but it's still under construction. Expression evaluator is used not only for luts but in parameter parsing as well (mt_convolution for example) which behaves a bit differently inside.

pinterf commented 3 years ago

Actual "nightly" build https://drive.google.com/uc?export=download&id=1HrkfZ626tIcDGpIREguSX5H4bxRLar2s

TbtBI commented 3 years ago

It looks ok.

Thanks.