[TR24731-1] provides a consistent mechanism to handle constraints violations that are discerned at runtime. Most functions defined by [TR24731-1] include as part of their specification a list of runtime-constraints. Library implementations must verify that the runtime-constraints for a function are not violated by the program. If a runtime-constraint is violated, the runtime-constraint handler currently registered with set_constraint_handler_s()
is called.
...
The runtime-constraint handler might not return. If the handler does return, the library function whose runtime-constraint was violated shall return some indication of failure as given by the returns section in the function's specification.
Wiki Markup |
---|
These runtime constraint handlers mitigate some of the potential insecurity caused by in-band error |
indicators (see \[[ERR02-A. Avoid in-band error indicators]\]). |
Non-Compliant Code Example
...
Wiki Markup |
---|
\[[ISO/IEC TR 24731-1-2007|AA. C References#ISO/IEC TR 24731-1-2007]\] Section 6.1.4, "Runtime-constraint violations"
\[[MSDN|AA. C References#MSDN]\] "[Parameter Validation|http://msdn.microsoft.com/en-us/library/ksazx244.aspx]" |
...