You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/10/17 14:52:50 UTC
(nuttx) 03/04: strcpy:skip ubsan check.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit fba3967f2f30de5094db4994aaaa4008ec86db8e
Author: yangguangcai <ya...@xiaomi.com>
AuthorDate: Mon Apr 22 14:28:11 2024 +0800
strcpy:skip ubsan check.
string/lib_strcpy.c:87:15: runtime error: signed integer overflow: -2132367969 - 16843009 cannot be represented in type 'long int'
#0 0x48e77096 in strcpy string/lib_strcpy.c:87
#1 0x535b6ea4 in libconfig_strbuf_append_string libconfig/lib/strbuf.c:60
#2 0x53ad7f52 in libconfig_yyparse /home/ygc/ssd/x4b-sim/external/libconfig/grammar.y:186
#3 0x5358d281 in __config_read libconfig/lib/libconfig.c:561
#4 0x5358dea0 in config_read_file libconfig/lib/libconfig.c:677
#5 0x52cdd0a5 in tts_vendor_list_get src/vendor.c:114
#6 0x52cde739 in default_tts_vendor_get src/vendor.c:356
#7 0x52a07e1d in vendorswitch_init src/vendorswitch/vendorswitch.c:501
#8 0x52444fb9 in mico_misc_main /home/ygc/ssd/x4b-sim/vendor/xiaomi/miai/mico_misc/instance/main.c:72
#9 0x48bee720 in nxtask_startup sched/task_startup.c:70
#10 0x48b41eb4 in nxtask_start task/task_start.c:112
#11 0x48c1ef3d in pre_start sim/sim_initialstate.c:52
Signed-off-by: yangguangcai <ya...@xiaomi.com>
---
libs/libc/string/lib_strcpy.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libs/libc/string/lib_strcpy.c b/libs/libc/string/lib_strcpy.c
index b8d34089ba..d51718d0a6 100644
--- a/libs/libc/string/lib_strcpy.c
+++ b/libs/libc/string/lib_strcpy.c
@@ -76,15 +76,15 @@ FAR char *strcpy(FAR char *dest, FAR const char *src)
#ifdef CONFIG_LIBC_STRING_OPTIMIZE
FAR char *dst0 = dest;
FAR const char *src0 = src;
- FAR long *aligned_dst;
- FAR const long *aligned_src;
+ FAR unsigned long *aligned_dst;
+ FAR const unsigned long *aligned_src;
/* If SRC or DEST is unaligned, then copy bytes. */
if (!UNALIGNED(src0, dst0))
{
- aligned_dst = (FAR long *)dst0;
- aligned_src = (FAR long *)src0;
+ aligned_dst = (FAR unsigned long *)dst0;
+ aligned_src = (FAR unsigned long *)src0;
/* SRC and DEST are both "long int" aligned, try to do "long int"
* sized copies.