comparison src/regexp.c @ 6785:de90405940be v7.4.714

patch 7.4.714 Problem: Illegal memory access when there are illegal bytes. Solution: Check the byte length of the character. (Dominique Pelle)
author Bram Moolenaar <bram@vim.org>
date Mon, 04 May 2015 09:56:49 +0200
parents ec46a5ca1b51
children 70fdcdaf96a6
comparison
equal deleted inserted replaced
6784:b11cc98ca985 6785:de90405940be
6111 * compiling the program). */ 6111 * compiling the program). */
6112 if ((len = (*mb_ptr2len)(opnd)) > 1) 6112 if ((len = (*mb_ptr2len)(opnd)) > 1)
6113 { 6113 {
6114 if (ireg_ic && enc_utf8) 6114 if (ireg_ic && enc_utf8)
6115 cf = utf_fold(utf_ptr2char(opnd)); 6115 cf = utf_fold(utf_ptr2char(opnd));
6116 while (count < maxcount) 6116 while (count < maxcount && (*mb_ptr2len)(scan) >= len)
6117 { 6117 {
6118 for (i = 0; i < len; ++i) 6118 for (i = 0; i < len; ++i)
6119 if (opnd[i] != scan[i]) 6119 if (opnd[i] != scan[i])
6120 break; 6120 break;
6121 if (i < len && (!ireg_ic || !enc_utf8 6121 if (i < len && (!ireg_ic || !enc_utf8