comparison src/viminfo.c @ 32860:38e797adc24d v9.0.1740

patch 9.0.1740: segfault when reading invalid viminfo file Commit: https://github.com/vim/vim/commit/0a0764684591c7c6a5d722b628f11dc96208e853 Author: Pierre Colin <48397990+Pierre-Colin@users.noreply.github.com> Date: Sat Aug 19 11:56:57 2023 +0200 patch 9.0.1740: segfault when reading invalid viminfo file Problem: segfault when reading invalid viminfo file Solution: Check the expected type in the viminfo file Thanks to @yegappan for the included test. closes: #12652 closes: #12845 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Pierre Colin <48397990+Pierre-Colin@users.noreply.github.com> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com> Co-authored-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sat, 19 Aug 2023 12:15:03 +0200
parents 04d9dff67d99
children 29b2193466e0
comparison
equal deleted inserted replaced
32859:0b90c5764f94 32860:38e797adc24d
1802 if (vp[i + 6].bv_allocated) 1802 if (vp[i + 6].bv_allocated)
1803 { 1803 {
1804 y_ptr->y_array[i] = vp[i + 6].bv_string; 1804 y_ptr->y_array[i] = vp[i + 6].bv_string;
1805 vp[i + 6].bv_string = NULL; 1805 vp[i + 6].bv_string = NULL;
1806 } 1806 }
1807 else if (vp[i + 6].bv_type != BVAL_STRING)
1808 {
1809 free(y_ptr->y_array);
1810 y_ptr->y_array = NULL;
1811 }
1807 else 1812 else
1808 y_ptr->y_array[i] = vim_strsave(vp[i + 6].bv_string); 1813 y_ptr->y_array[i] = vim_strsave(vp[i + 6].bv_string);
1809 } 1814 }
1810 } 1815 }
1811 1816