Sorry, life happened and I didn’t manage the complete the process, yet.
I want to lift the function from the codebase and wrap it as a small utility to test some scenarios, and write a report with possible remedies as the bug report. I’ll copy the tech report, the code and link here. I’m planning to do it ASAP (this weekend if I can manage to do it).
Since it’s pretty low-level, I don’t want to give it half an effort and let it go waste. I want to provide a feasible solution, as well.