Fix substitute-command-keys unibyte, alloc bugs
commit2791580f5eaa65948a13ea4ea4952d03b4da795b
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 14 Aug 2016 04:26:00 +0000 (13 23:26 -0500)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 14 Aug 2016 04:32:36 +0000 (13 23:32 -0500)
tree843389a61dd4c8d85e326b27a6bedee4e87467ac
parentc1021ba910efac334027ad03ff6aed64306fad3c
Fix substitute-command-keys unibyte, alloc bugs

* src/doc.c (Fsubstitute_command_keys): Fix some problems with
unibyte strings and with buffer allocation.  Make strings
multibyte, to avoid problems with unibyte strings that are not
valid UTF-8 (Bug#24206).  Redo buffer allocation so that it is
O(N), not O(N**2).  Avoid going past the end of the input string
when given invalid input.  Avoid some unlikely problems in
accessing the wrong storage after a GC.
src/doc.c