[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[patch] crash on multibyte editing in C locale
From: |
Tim Waugh |
Subject: |
[patch] crash on multibyte editing in C locale |
Date: |
Thu, 18 Sep 2003 15:17:51 +0100 |
User-agent: |
Mutt/1.4.1i |
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: i386-redhat-linux-gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu'
-DCONF_VENDOR='redhat' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib
-D_FILE_OFFSET_BITS=64 -O2 -g -pipe -march=i386 -mcpu=i686
uname output: Linux gene.surrey.redhat.com 2.4.22-1.2030.nptl #1 Sun Sep 7
08:33:58 EDT 2003 i686 i686 i386 GNU/Linux
Machine Type: i386-redhat-linux-gnu
Bash Version: 2.05b
Patch Level: 0
Release Status: release
Description:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=74266
With multibyte history, but locale set to 'C', scrolling back
through history and editing it can cause a segmentation
fault.
Repeat-By:
See bug report URL above (start at comment #14).
Fix:
--- bash-2.05b/lib/readline/mbutil.c.crash 2003-09-18 12:24:18.000000000
+0100
+++ bash-2.05b/lib/readline/mbutil.c 2003-09-18 12:25:44.000000000 +0100
@@ -205,14 +205,14 @@
if (tmp == (size_t)(-2))
{
/* shorted to compose multibyte char */
- memset (ps, 0, sizeof(mbstate_t));
+ if (ps) memset (ps, 0, sizeof(mbstate_t));
return -2;
}
else if (tmp == (size_t)(-1))
{
/* invalid to compose multibyte char */
/* initialize the conversion state */
- memset (ps, 0, sizeof(mbstate_t));
+ if (ps) memset (ps, 0, sizeof(mbstate_t));
return -1;
}
else if (tmp == (size_t)0)
@@ -276,7 +276,7 @@
pos++;
/* clear the state of the byte sequence, because
in this case effect of mbstate is undefined */
- memset (ps, 0, sizeof (mbstate_t));
+ if (ps) memset (ps, 0, sizeof (mbstate_t));
}
else
pos += tmp;
- [patch] crash on multibyte editing in C locale,
Tim Waugh <=