You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The gnulib unit test tests/test-wcrtomb.sh fails on CheriBSD, while it succeeds on FreeBSD 14.0.
$ LC_ALL=zh_CN.GB18030 ./test-wcrtomb 5
In-address space security exception (core dumped)
In gdb, I get this stack trace:
(gdb) where
#0 strlen (str=0xfffffff7fcfc [rwRW,0xfffffff7fcfc-0xfffffff7fcfd] "\t")
at /local/scratch/jenkins/workspace/CheriBSD-pipeline_releng_22.12@2/cheribsd/lib/libc/string/strlen.c:146
#1 0x0000000040268790 in _GB18030_mbrtowc (
pwc=0xfffffff7fcf8 [rwRW,0xfffffff7fcf8-0xfffffff7fcfc] L"",
s=0xfffffff7fcfc [rwRW,0xfffffff7fcfc-0xfffffff7fcfd] "\t", n=1,
ps=0xfffffff7fd00 [rwRW,0xfffffff7fd00-0xfffffff7fd80])
at /local/scratch/jenkins/workspace/CheriBSD-pipeline_releng_22.12@2/cheribsd/lib/libc/locale/gb18030.c:127
#2 0x00000000402670a4 in btowc_l (l=<optimized out>, c=<optimized out>)
at /local/scratch/jenkins/workspace/CheriBSD-pipeline_releng_22.12@2/cheribsd/lib/libc/locale/btowc.c:58
#3 btowc (c=<optimized out>)
at /local/scratch/jenkins/workspace/CheriBSD-pipeline_releng_22.12@2/cheribsd/lib/libc/locale/btowc.c:65
#4 0x0000000000111540 in main (argc=2,
argv=0xffffbff7f620 [rwRW,0xffffbff7f620-0xffffbff7f650])
at ../../gltests/test-wcrtomb.c:101
In lib/libc/locale/gb18030.c line 125 or 127, it is wrong to call strlen(s), because s cannot be assumed to be NUL-terminated here. The function must only access s[0], ..., s[n-1] and must not make any assumptions about these n bytes.
The gnulib unit test
tests/test-wcrtomb.sh
fails on CheriBSD, while it succeeds on FreeBSD 14.0.In gdb, I get this stack trace:
In
lib/libc/locale/gb18030.c
line 125 or 127, it is wrong to callstrlen(s)
, becauses
cannot be assumed to be NUL-terminated here. The function must only accesss[0], ..., s[n-1]
and must not make any assumptions about thesen
bytes.This bug was introduced in 92bb865 .
The text was updated successfully, but these errors were encountered: