diff options
| author | Philipp Stephani | 2017-06-05 22:09:00 +0200 |
|---|---|---|
| committer | Philipp Stephani | 2017-06-05 22:09:22 +0200 |
| commit | 3d9d976aa476b1c1098359a1215ad1cabd022d33 (patch) | |
| tree | d9448221cc3a178ae505155229a4d216382dfae1 /src | |
| parent | 9ae5c0a2e12c25f37736d9b106c55227b55521e6 (diff) | |
| download | emacs-3d9d976aa476b1c1098359a1215ad1cabd022d33.tar.gz emacs-3d9d976aa476b1c1098359a1215ad1cabd022d33.zip | |
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.c | 6 |
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. */) | |||
| 3613 | 3613 | ||
| 3614 | while (backtrace_p (pdl)) | 3614 | while (backtrace_p (pdl)) |
| 3615 | { | 3615 | { |
| 3616 | ptrdiff_t i = pdl - specpdl; | ||
| 3616 | backtrace_frame_apply (function, pdl); | 3617 | backtrace_frame_apply (function, pdl); |
| 3617 | pdl = backtrace_next (pdl); | 3618 | /* Beware! PDL is no longer valid here because FUNCTION might |
| 3619 | have caused grow_specpdl to reallocate pdlvec. We must use | ||
| 3620 | the saved index, cf. Bug#27258. */ | ||
| 3621 | pdl = backtrace_next (&specpdl[i]); | ||
| 3618 | } | 3622 | } |
| 3619 | 3623 | ||
| 3620 | return Qnil; | 3624 | return Qnil; |