History log of /netbsd-src/lib/libedit/chartype.c (Results 1 – 25 of 37)
Revision Date Author Comments
# aec4d439 10-Aug-2023 mrg <mrg@NetBSD.org>

avoid various use-after-free issues.

create a ptrdiff_t offset between the start of an allocation region and
some interesting pointer, so it can be adjusted with this offset after
realloc() returns.

avoid various use-after-free issues.

create a ptrdiff_t offset between the start of an allocation region and
some interesting pointer, so it can be adjusted with this offset after
realloc() returns.

found by GCC 12.

show more ...


# 21a4b1cc 30-Oct-2022 christos <christos@NetBSD.org>

improvements in malloc/free handling.


# 113f06a3 23-Jul-2019 christos <christos@NetBSD.org>

PR/54399: Sören Tempel: Uninitialized memory access in libedit history.
Initialize the buffer using calloc. While here change all malloc(a * sizeof(b))
to calloc(a, sizeof(b)). XXX: should fix reallo

PR/54399: Sören Tempel: Uninitialized memory access in libedit history.
Initialize the buffer using calloc. While here change all malloc(a * sizeof(b))
to calloc(a, sizeof(b)). XXX: should fix realloc similarly.

show more ...


# 2cb4fa42 25-Nov-2018 christos <christos@NetBSD.org>

From Yuichiro Naito (FreeBSD):
hrs@ says that wctomb(3) has an internal shift state,
if wctomb(3) is called outside of libedit,
the internal state can be changed and causes miscalculate multibyte siz

From Yuichiro Naito (FreeBSD):
hrs@ says that wctomb(3) has an internal shift state,
if wctomb(3) is called outside of libedit,
the internal state can be changed and causes miscalculate multibyte size.

So in this part, wcrtomb(3) should be used.
wcrtomb(3) requires that shift state is given in the argument.
We always initialize the shift state in ct_enc_width() to keep independent
from outside of libedit.

show more ...


# e91c3053 18-Nov-2018 christos <christos@NetBSD.org>

fix compilation


# 18bb6ea4 18-Nov-2018 christos <christos@NetBSD.org>

Remove utf-8 requirement (Yuichiro NAITO)


# 4937de3b 09-Jan-2017 christos <christos@NetBSD.org>

Make sure that argv is NULL terminated since functions like tty_stty rely
on it to be so (Gerry Swinslow)


# a2d6b270 09-May-2016 christos <christos@NetBSD.org>

s/protected/libedit_private/g


# 300e2ca4 02-May-2016 christos <christos@NetBSD.org>

eliminate static buffer with custom resizing code.


# 469d44f8 11-Apr-2016 christos <christos@NetBSD.org>

Get rid of private/public; keep protected (Ingo Schwarze)


# a75ea7b9 11-Apr-2016 christos <christos@NetBSD.org>

chartype cleanups from Ingo Schwarze:

- The file tokenizer.c no longer uses chartype.h,
so don't include the header.

- The dummy definitions of ct_{de,en}code_string() for the
NARROWCHAR ca

chartype cleanups from Ingo Schwarze:

- The file tokenizer.c no longer uses chartype.h,
so don't include the header.

- The dummy definitions of ct_{de,en}code_string() for the
NARROWCHAR case are only used in history.c, so move them there.

- Now the whole content of chartype.h is for the wide character
case only. So remove the NARROWCHAR ifdef and include the
header only in the wide character case.

- In chartype.h, move ct_encode_char() below the comment explaining it.

- No more need for underscores before ct_{de,en}code_string().

- Make the conversion buffer resize functions private.
They are only called from the decoding and encoding functions
inside chartype.c, and no need can possibly arise to call them
from anywhere else.

show more ...


# 0594af80 11-Apr-2016 christos <christos@NetBSD.org>

Char -> wchar_t from Ingo Schwarze.


# fcf85103 09-Apr-2016 christos <christos@NetBSD.org>

More WIDECHAR elimination (Ingo Schwarze)


# 4e541d85 23-Mar-2016 christos <christos@NetBSD.org>

Start removing the WIDECHAR ifdefs; building without it has stopped working
anyway. (Ingo Schwarze)


# fc5e336a 28-Feb-2016 christos <christos@NetBSD.org>

remove 4 clause licenses.


# fe2cf455 24-Feb-2016 christos <christos@NetBSD.org>

Tuck in mbstate_t to the wide char version only to avoid exposing the zeroing
hack and doing it in the narrow case.


# 94623721 24-Feb-2016 christos <christos@NetBSD.org>

Make the read_char function always take a wchar_t * argument (Ingo Schwarze)


# 7ba8c71b 24-Feb-2016 christos <christos@NetBSD.org>

Get split el_getc and el_wgetc completely and call el_wgetc internally.
Change some character constants to they wide versions. (Ingo Schwarze)


# 22383670 17-Feb-2016 christos <christos@NetBSD.org>

whitespace and header sorting changes (Ingo Schwarze). No functional changes.


# e84df91e 16-Feb-2016 christos <christos@NetBSD.org>

More header cleanups from Ingo Schwarze.


# aefc1e44 16-Feb-2016 christos <christos@NetBSD.org>

From Ingo Scharze:
Let "el.h" include everything needed for struct editline,
and don't include that stuff multiple times. That also improves
consistency, also avoids circular inclusions, and also ma

From Ingo Scharze:
Let "el.h" include everything needed for struct editline,
and don't include that stuff multiple times. That also improves
consistency, also avoids circular inclusions, and also makes it
easier to follow what is going on, even though not quite as nice.
But it seems like the best we can do...

show more ...


# f09cb8c6 16-Feb-2016 christos <christos@NetBSD.org>

cleanup chartype.h includes (Ingo Schwarze)


# 40850369 16-Feb-2016 christos <christos@NetBSD.org>

cleanup inclusion of histedit.h (Ingo Schwarze)


# 61ee3048 14-Feb-2016 christos <christos@NetBSD.org>

From Ingo Schwartze:

Next step: Remove #ifdef'ing in read_char(), in the same style
as we did for setlocale(3) in el.c.

A few remarks are required to explain the choices made.

* On first sight,

From Ingo Schwartze:

Next step: Remove #ifdef'ing in read_char(), in the same style
as we did for setlocale(3) in el.c.

A few remarks are required to explain the choices made.

* On first sight, handling mbrtowc(3) seems a bit less trivial
than handling setlocale(3) because its prototype uses the data
type mbstate_t from <wchar.h>. However, it turns out that
"histedit.h" already includes <wchar.h> unconditionally (i don't
like headers including other headers, but that ship has sailed,
people are by now certainly used to the fact that including
"histedit.h" doesn't require including <wchar.h> before), and
"histedit.h" is of course included all over the place. So from
that perspective, there is no problem with using mbrtowc(3)
unconditionally ever for !WIDECHAR.

* However, <wchar.h> also defines the mbrtowc(3) prototype,
so we cannot just #define mbrtowc away, or including the header
will break. It would also be a bad idea to porovide a local
implementation of mbrtowc() and hope that it overrides the one
in libc. Besides, the required prototype is subtly different:
While mbrtowc(3) takes "wchar_t *" as its first argument, we
need a function that takes "Char *". So unfortunately, we have
to keep a ct_mbrtowc #define, at least until we can maybe get
rid of "Char *" in the more remote future.

* After getting rid of the #else clause in read_char(), we can
pull "return 1;" into the default: clause. After that, we can
get rid of the ugly "goto again_lastbyte;" and just "break;".
As a bonus, that also gets rid of the ugly CONSTCOND.

* While here, delete the unused ct_mbtowc() from chartype.h.

show more ...


# 6af8d673 11-Feb-2016 christos <christos@NetBSD.org>

- Add some more Char casts
- reduce ifdefs by providing empty defs for nls functions (Ingo Schwarze)


12