masks: quick fix for #9833

I still need to reconsider the logics and right places for buffer allocation
Look for external programs early on and complain