Mercurial > vim
comparison src/eval.c @ 20540:193c0446cf28 v8.2.0824
patch 8.2.0824: still not enough memory allocated when converting string
Commit: https://github.com/vim/vim/commit/1919371b2b9ddb1a645f40b59adbd89317530882
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon May 25 23:01:42 2020 +0200
patch 8.2.0824: still not enough memory allocated when converting string
Problem: Still not enough memory allocated when converting string with
special character.
Solution: Reserve space for expanding K_SPECIAL. (closes #6130)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 25 May 2020 23:15:03 +0200 |
parents | 489cb75c76b6 |
children | f502455965c0 |
comparison
equal
deleted
inserted
replaced
20539:ca1354820ef2 | 20540:193c0446cf28 |
---|---|
3513 { | 3513 { |
3514 if (*p == '\\' && p[1] != NUL) | 3514 if (*p == '\\' && p[1] != NUL) |
3515 { | 3515 { |
3516 ++p; | 3516 ++p; |
3517 // A "\<x>" form occupies at least 4 characters, and produces up | 3517 // A "\<x>" form occupies at least 4 characters, and produces up |
3518 // to 9 characters (6 for the char and 3 for a modifier): reserve | 3518 // to 21 characters (3 * 6 for the char and 3 for a modifier): |
3519 // space for 5 extra. | 3519 // reserve space for 18 extra. |
3520 // Each byte in the char could be encoded as K_SPECIAL K_EXTRA x. | |
3520 if (*p == '<') | 3521 if (*p == '<') |
3521 extra += 5; | 3522 extra += 18; |
3522 } | 3523 } |
3523 } | 3524 } |
3524 | 3525 |
3525 if (*p != '"') | 3526 if (*p != '"') |
3526 { | 3527 { |