rebol/rebol — pull request #229 by zsx (2014-12-10 16:36:26+00:00)
Title: Restore Saved_State/Halt_State when a longjmp happens

this fixes CC#2190, which is illustrated by:

attempt [; this sets Saved_State
catch/quit [ ;this calls Try_Block_Halt and sets Halt_State
print x ; this causes an error, and calls
;"longjmp(*State_State)", which invalidates
; Halt_State above.
]
]
load %./ ;Just tries to fill up the C stack and messes up "Halt_State".
halt ; Jumps to the invalid "Halt_State", and crashes

or

catch/quit [ ;sets Halt_State
attempt [ ;sets Saved_State
quit ; jumps to Halt_State, and invalidates "Saved_State"
]
]
print x ; Causes a jump to the invalid "Saved_State"