summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Stephani <phst@google.com>2017-06-05 22:09:00 +0200
committerPhilipp Stephani <phst@google.com>2017-06-05 22:09:22 +0200
commit3d9d976aa476b1c1098359a1215ad1cabd022d33 (patch)
treed9448221cc3a178ae505155229a4d216382dfae1 /src
parent9ae5c0a2e12c25f37736d9b106c55227b55521e6 (diff)
downloademacs-3d9d976aa476b1c1098359a1215ad1cabd022d33.tar.gz
Fix undefined behavior in mapbacktrace
* src/eval.c (Fmapbacktrace): Don't assume that PDL is still valid.
Diffstat (limited to 'src')
-rw-r--r--src/eval.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/eval.c b/src/eval.c
index ef961046bcf..8f293c9d300 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -3613,8 +3613,12 @@ returns nil. */)
while (backtrace_p (pdl))
{
+ ptrdiff_t i = pdl - specpdl;
backtrace_frame_apply (function, pdl);
- pdl = backtrace_next (pdl);
+ /* Beware! PDL is no longer valid here because FUNCTION might
+ have caused grow_specpdl to reallocate pdlvec. We must use
+ the saved index, cf. Bug#27258. */
+ pdl = backtrace_next (&specpdl[i]);
}
return Qnil;