mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-13 19:52:20 +00:00
emacs: Fix crash on inputting Asian chars (Solaris 240-22461939)
This change is pulled from here: https://github.com/oracle/solaris-userland/blob/master/components/ksh93/patches/240-22461939.patch Information: https://github.com/att/ast/issues/6 George Lijo wrote on 14 Mar 2016: > I observed this issue in a Solaris 11 system on ksh2012-08-01 > [...]. The issue can be reproduced if we add Asian locales to > ibus (such as Korean). In the ksh93 shell prompt, input some > Asian character. ksh promptly dumps core [...]. > > The coredump happens at the following line no 320 in > src/cmd/ksh93/edit/emacs.c > if(c!='\t' && c!=ESC && !isdigit(c)). > > I referred the vi.c code and added the digit(c) macro, i.e. > ((c&~STRIP)==0 && isdigit(c)) and replaced the isdigit(c) usage > with the "digit(c)" macro.
This commit is contained in:
parent
a3ccff6c75
commit
3f38f8a285
1 changed files with 5 additions and 3 deletions
|
@ -90,6 +90,7 @@ One line screen editor for any program
|
|||
static int print(int);
|
||||
static int _isword(int);
|
||||
# define isword(c) _isword(out[c])
|
||||
# define digit(c) ((c&~STRIP)==0 && isdigit(c))
|
||||
|
||||
#else
|
||||
# define gencpy(a,b) strcpy((char*)(a),(char*)(b))
|
||||
|
@ -97,6 +98,7 @@ One line screen editor for any program
|
|||
# define genlen(str) strlen(str)
|
||||
# define print(c) isprint(c)
|
||||
# define isword(c) (isalnum(out[c]) || (out[c]=='_'))
|
||||
# define digit(c) isdigit(c)
|
||||
#endif /*SHOPT_MULTIBYTE */
|
||||
|
||||
typedef struct _emacs_
|
||||
|
@ -323,7 +325,7 @@ int ed_emacsread(void *context, int fd,char *buff,int scend, int reedit)
|
|||
count = 1;
|
||||
adjust = -1;
|
||||
i = cur;
|
||||
if(c!='\t' && c!=ESC && !isdigit(c))
|
||||
if(c!='\t' && c!=ESC && !digit(c))
|
||||
ep->ed->e_tabcount = 0;
|
||||
switch(c)
|
||||
{
|
||||
|
@ -782,7 +784,7 @@ static int escape(register Emacs_t* ep,register genchar *out,int count)
|
|||
int digit,ch;
|
||||
digit = 0;
|
||||
value = 0;
|
||||
while ((i=ed_getchar(ep->ed,0)),isdigit(i))
|
||||
while ((i=ed_getchar(ep->ed,0)),digit(i))
|
||||
{
|
||||
value *= 10;
|
||||
value += (i - '0');
|
||||
|
@ -1020,7 +1022,7 @@ static int escape(register Emacs_t* ep,register genchar *out,int count)
|
|||
{
|
||||
i=ed_getchar(ep->ed,0);
|
||||
ed_ungetchar(ep->ed,i);
|
||||
if(isdigit(i))
|
||||
if(digit(i))
|
||||
ed_ungetchar(ep->ed,ESC);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue