Error Handling #555
-
All across the source code of KTX-Software there are assertions like this one: assert(colorModel == KHR_DF_MODEL_UASTC); Although it makes sense to stop execution if assertions are not met, usually this means the whole application crashes. Is there a way or plan to have proper error handling? KTX files (or data in general) can be corrupt, either by technical defect or maliciously. For stability and security reasons it would be great if KTX-Software offers a way to handle all sorts of corrupted data errors. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
There is proper error handling. All assertions are intended to check code integrity not file integrity. The latter checks normally happen during file loading and various return codes are used. Similar looking asserts are often used elsewhere to check that the code hasn't made unexpected changes to the data since the file integrity check. In the case you point out there is a check near the top of the function
This is not quite complete as it doesn't check the color model is ETC1S when the supercompression scheme is BASIS_LZ. In any case the assert is not doing anything useful as the code between the 2 places is straightforward and clearly not changing the color model. I will remove the assert and make the initial check more robust. I have never deliberately written an assert to check file integrity. If there are others that inadvertently do so, please point them out. |
Beta Was this translation helpful? Give feedback.
There is proper error handling. All assertions are intended to check code integrity not file integrity. The latter checks normally happen during file loading and various return codes are used. Similar looking asserts are often used elsewhere to check that the code hasn't made unexpected changes to the data since the file integrity check.
In the case you point out there is a check near the top of the function
This is not quite complete as it doesn't check the color model is ETC1S when the supercompression scheme is BASIS_LZ…