Mercurial > vim
comparison src/testdir/test_undo.vim @ 32909:b80d18055370 v9.0.1763
patch 9.0.1763: crash when passing invalid buffer to undotree()
Commit: https://github.com/vim/vim/commit/ab9f2ecfd4ecaf74eeed0e5ec41355589af3ec8f
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sun Aug 20 18:35:10 2023 +0200
patch 9.0.1763: crash when passing invalid buffer to undotree()
Problem: crash when passing invalid buffer to undotree()
Solution: Use get_buf_arg() instead of tv_get_buf_from_arg().
closes: #12862
closes: #12830
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 20 Aug 2023 18:45:03 +0200 |
parents | 257ab4ee8e4a |
children | db2e9816e400 |
comparison
equal
deleted
inserted
replaced
32908:cfa0ccf8d390 | 32909:b80d18055370 |
---|---|
131 call assert_equal(d1, d) | 131 call assert_equal(d1, d) |
132 | 132 |
133 let d = undotree(buf2) | 133 let d = undotree(buf2) |
134 call assert_notequal(d1, d) | 134 call assert_notequal(d1, d) |
135 call assert_equal(d2, d) | 135 call assert_equal(d2, d) |
136 | |
137 " error cases | |
138 call assert_fails('call undotree(-1)', 'E158:') | |
139 call assert_fails('call undotree("nosuchbuf")', 'E158:') | |
140 | |
141 " after creating a buffer nosuchbuf, undotree('nosuchbuf') should | |
142 " not error out | |
143 new nosuchbuf | |
144 let d = {'seq_last': 0, 'entries': [], 'time_cur': 0, 'save_last': 0, 'synced': 1, 'save_cur': 0, 'seq_cur': 0} | |
145 call assert_equal(d, undotree("nosuchbuf")) | |
146 " clean up | |
147 bw nosuchbuf | |
136 | 148 |
137 " Drop created windows | 149 " Drop created windows |
138 set ul& | 150 set ul& |
139 new | 151 new |
140 only! | 152 only! |