Control is transferred with setjmp and longjmp
What it finds
longjmp jumps back into a function that called setjmp, past every function in between, which do not get to free what they hold, and local variables changed since the setjmp have unreliable values unless they are volatile.
From the rule's source, setjmp_longjmp.rs.
#include <setjmp.h> static jmp_buf env; void fail(void){ longjmp(env, 1);tx0 reports: longjmp transfers control past the functions in between} Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/c:setjmp-longjmp" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/c:setjmp-longjmp] reason="..."tx0 explain tx0/c:setjmp-longjmp shows the same in the terminal. Found a false positive? Report it.