Problem: Possible overflow when reading corrupted undo file.
Solution: Check if allocated size is not too big. (King)
linenr_T line_lnum;
colnr_T line_colnr;
linenr_T line_count;
- int num_head = 0;
+ long num_head = 0;
long old_header_seq, new_header_seq, cur_header_seq;
long seq_last, seq_cur;
long last_save_nr = 0;
* When there are no headers uhp_table is NULL. */
if (num_head > 0)
{
- uhp_table = (u_header_T **)U_ALLOC_LINE(
+ if (num_head < LONG_MAX / (long)sizeof(u_header_T *))
+ uhp_table = (u_header_T **)U_ALLOC_LINE(
num_head * sizeof(u_header_T *));
if (uhp_table == NULL)
goto error;
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 377,
/**/
376,
/**/