nuttx/libs/libc/stdlib
chao an 3403b983ec libc/qsort: fix invalid-pointer-pair if enable detect_invalid_pointer_pairs=2
=================================================================
==2920138==ERROR: AddressSanitizer: invalid-pointer-pair: 0x603000000130 0x000000000000
    #0 0x5602d3c6a89d in qsort stdlib/lib_qsort.c:180
    #1 0x5602d3c28928 in romfs_cachenode romfs/fs_romfsutil.c:503
    #2 0x5602d3c2854d in romfs_cachenode romfs/fs_romfsutil.c:486
    #3 0x5602d3c2b056 in romfs_fsconfigure romfs/fs_romfsutil.c:777
    #4 0x5602d3c24856 in romfs_bind romfs/fs_romfs.c:1111
    #5 0x5602d3bf5179 in nx_mount mount/fs_mount.c:427
    #6 0x5602d3bf5796 in mount mount/fs_mount.c:539
    #7 0x5602d3bc1154 in nsh_romfsetc apps/nshlib/nsh_romfsetc.c:110
    #8 0x5602d3b8f38d in nsh_initialize apps/nshlib/nsh_init.c:127
    #9 0x5602d3b8f2b7 in nsh_main apps/system/nsh/nsh_main.c:69
    #10 0x5602d3b7a3a6 in nxtask_startup sched/task_startup.c:70
    #11 0x5602d3b5de89 in nxtask_start task/task_start.c:134

0x603000000130 is located 0 bytes inside of 32-byte region [0x603000000130,0x603000000150)
allocated by thread T0 here:
    #0 0x7fcdac74793c in __interceptor_posix_memalign ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:226
    #1 0x5602d3c9024e in host_memalign sim/posix/sim_hostmemory.c:180
    #2 0x5602d3c907d2 in host_realloc sim/posix/sim_hostmemory.c:222
    #3 0x5602d3b8aaff in mm_realloc sim/sim_heap.c:262
    #4 0x5602d3b87a6a in realloc umm_heap/umm_realloc.c:91
    #5 0x5602d3c280c4 in romfs_cachenode romfs/fs_romfsutil.c:466
    #6 0x5602d3c2854d in romfs_cachenode romfs/fs_romfsutil.c:486
    #7 0x5602d3c2b056 in romfs_fsconfigure romfs/fs_romfsutil.c:777
    #8 0x5602d3c24856 in romfs_bind romfs/fs_romfs.c:1111
    #9 0x5602d3bf5179 in nx_mount mount/fs_mount.c:427
    #10 0x5602d3bf5796 in mount mount/fs_mount.c:539
    #11 0x5602d3bc1154 in nsh_romfsetc apps/nshlib/nsh_romfsetc.c:110
    #12 0x5602d3b8f38d in nsh_initialize apps/nshlib/nsh_init.c:127
    #13 0x5602d3b8f2b7 in nsh_main apps/system/nsh/nsh_main.c:69
    #14 0x5602d3b7a3a6 in nxtask_startup sched/task_startup.c:70
    #15 0x5602d3b5de89 in nxtask_start task/task_start.c:134

Address 0x000000000000 is a wild pointer.
SUMMARY: AddressSanitizer: invalid-pointer-pair stdlib/lib_qsort.c:180 in qsort
==2920138==ABORTING
Aborted (core dumped)

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-08 13:43:28 +02:00
..
Kconfig libc: Implement exit, atexit, on_exit and cxa_exit on the user side 2022-05-25 15:28:43 +08:00
lib_abort.c lib_abort.c: Change call to userspace exit() into syscall _exit() 2023-02-22 01:10:39 +08:00
lib_abs.c libs: nxstyle fixes 2021-03-03 18:52:53 -08:00
lib_aligned_alloc.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_atexit.c libc: Move on_exit and __cxa_atexit in lib_atexit.c 2023-01-25 14:31:37 +02:00
lib_atof.c
lib_atoi.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_atol.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_atoll.c
lib_bsearch.c
lib_checkbase.c libs: nxstyle fixes 2021-03-03 18:52:53 -08:00
lib_div.c Fix various typos in comments and documentation 2021-07-04 11:23:26 -05:00
lib_exit.c libc: Cleanup per-thread resource in exit/quick_exit 2023-04-25 16:52:08 +03:00
lib_getprogname.c libc: Add getprogname function 2021-12-15 10:47:56 -06:00
lib_itoa.c libs: fix nxstyle errors 2021-04-02 11:12:25 -05:00
lib_labs.c libs: nxstyle fixes 2021-03-03 18:52:53 -08:00
lib_ldiv.c Fix various typos in comments and documentation 2021-07-04 11:23:26 -05:00
lib_llabs.c libs: nxstyle fixes 2021-03-03 18:52:53 -08:00
lib_lldiv.c Fix various typos in comments and documentation 2021-07-04 11:23:26 -05:00
lib_mblen.c libc/wchar: remove unnecessary config 2022-07-27 00:36:49 +08:00
lib_mbstowcs.c libc/wchar: remove unnecessary config 2022-07-27 00:36:49 +08:00
lib_mbtowc.c libc/wchar: support wchar 2022-07-27 00:36:49 +08:00
lib_mkdtemp.c
lib_mkstemp.c
lib_mktemp.c Replace nxsem API when used as a lock with nxmutex API 2022-10-17 15:59:46 +09:00
lib_openpty.c change strcpy to strlcpy 2023-02-24 12:15:40 +08:00
lib_posix_memalign.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_ptsname.c libc/pty: Make ptsname[_r] support PSEUDOTERM_BSD config too 2021-05-07 16:35:20 -03:00
lib_ptsnamer.c libc/pty: Make ptsname[_r] support PSEUDOTERM_BSD config too 2021-05-07 16:35:20 -03:00
lib_qsort.c libc/qsort: fix invalid-pointer-pair if enable detect_invalid_pointer_pairs=2 2023-05-08 13:43:28 +02:00
lib_rand48.c stdlib: generate uniformly distributed pseudo-random numbers 2023-01-04 20:53:05 +08:00
lib_rand.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_realpath.c libc: Don't duplicate string in chdir and lib_restoredir 2022-04-18 10:36:36 +03:00
lib_srand.c Rename LIB_ to LIBC_ for all libc Kconfig 2021-08-05 19:45:24 +02:00
lib_strtol.c libs: Gregory Nutt: update licenses to Apache 2021-04-02 11:12:25 -05:00
lib_strtold.c fix a bug of strtof 2023-02-22 01:20:21 +08:00
lib_strtoll.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_strtoul.c sourcefiles: Fix relative path in file header 2021-03-09 23:18:28 +08:00
lib_strtoull.c sourcefiles: Fix relative path in file header 2021-03-09 23:18:28 +08:00
lib_unlockpt.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_valloc.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_wcstombs.c libc/wchar: remove unnecessary config 2022-07-27 00:36:49 +08:00
lib_wctomb.c libc/wchar: support wchar 2022-07-27 00:36:49 +08:00
Make.defs Remove the tail spaces from all files except Documentation 2023-02-26 13:24:24 -08:00