about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-02-19 21:01:50 -0800
committerAlex Crichton <alex@alexcrichton.com>2014-02-25 16:51:52 -0800
commit4f4d43bf6cf6f36d5d0b3a1f890b1d88aec85538 (patch)
tree4878c5bb2f68f78506bb685cdae2e5b03c59da51 /src/rustllvm/RustWrapper.cpp
parent3c2650b4d570bee29332e75109687bc3d5d05b5c (diff)
downloadrust-4f4d43bf6cf6f36d5d0b3a1f890b1d88aec85538.tar.gz
rust-4f4d43bf6cf6f36d5d0b3a1f890b1d88aec85538.zip
std: Tweak stack overflow printing for robustness
The printing of the error message on stack overflow had two sometimes false
assumptions previously. The first is that a local task was always available (it
called Local::take) and the second is that it used println! instead of
manually writing.

The first assumption isn't necessarily true because while stack overflow will
likely only be detected in situations that a local task is available, it's not
guaranteed to always be in TLS. For example, during a println! call a task
may be blocking, causing it to be unavailable. By using Local::try_take(), we
can be resilient against these occurrences.

The second assumption could lead to odd behavior because the stdout logger can
be overwritten to run arbitrary code. Currently this should be possible, but the
utility is much diminished because a stack overflow translates to an abort()
instead of a failure.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions