gallium/swr: Fix various asserts and security issues
To improve the robustness of the code, we want to better detect issues in testing (using asserts) and use more secure techniques.
To improve the robustness of the code, we want to better detect issues in testing (using asserts) and use more secure techniques.