Samsung/360tools

memcpy-param-overlap in pad_erp_plane_10b (60tools_erp.c)

Opened this issue · 0 comments

On master, compiled with -fsanitize=address:

# 360tools_conv -i $FILE -o /tmp/out -w 1 -h 1 -f 0 -l 1 -m 1
==155340==ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges [0x61b000000080,0x61b0000000a0) and [0x61b000000082, 0x61b0000000a2) overlap
    #0 0x4b88e2 in __asan_memcpy /var/tmp/portage/sys-libs/compiler-rt-sanitizers-4.0.1/work/compiler-rt-4.0.1.src/lib/asan/asan_interceptors.cc:453
    #1 0x51bd55 in pad_erp_plane_10b /tmp/360tools/build/x86_linux/../../src/360tools_erp.c:254:3
    #2 0x51bd55 in s360_pad_erp /tmp/360tools/build/x86_linux/../../src/360tools_erp.c:299
    #3 0x51b0d6 in s360_erp_to_cpp /tmp/360tools/build/x86_linux/../../src/360tools_erp.c:108:3
    #4 0x50c658 in main /tmp/360tools/build/x86_linux/../../app/360tools_conv/360tools_conv.c:478:9
    #5 0x7f1f0ca67680 in __libc_start_main /var/tmp/portage/sys-libs/glibc-2.23-r4/work/glibc-2.23/csu/../csu/libc-start.c:289
    #6 0x419ac8 in _start (/usr/bin/360tools_conv+0x419ac8)

0x61b000000080 is located 0 bytes inside of 1536-byte region [0x61b000000080,0x61b000000680)
allocated by thread T0 here:
    #0 0x4cf478 in __interceptor_malloc /var/tmp/portage/sys-libs/compiler-rt-sanitizers-4.0.1/work/compiler-rt-4.0.1.src/lib/asan/asan_malloc_linux.cc:66
    #1 0x51050e in s360_img_create /tmp/360tools/build/x86_linux/../../src/360tools_img.c:76:21
    #2 0x50c1df in main /tmp/360tools/build/x86_linux/../../app/360tools_conv/360tools_conv.c:369:9
    #3 0x7f1f0ca67680 in __libc_start_main /var/tmp/portage/sys-libs/glibc-2.23-r4/work/glibc-2.23/csu/../csu/libc-start.c:289

0x61b000000082 is located 2 bytes inside of 1536-byte region [0x61b000000080,0x61b000000680)
allocated by thread T0 here:
    #0 0x4cf478 in __interceptor_malloc /var/tmp/portage/sys-libs/compiler-rt-sanitizers-4.0.1/work/compiler-rt-4.0.1.src/lib/asan/asan_malloc_linux.cc:66
    #1 0x51050e in s360_img_create /tmp/360tools/build/x86_linux/../../src/360tools_img.c:76:21
    #2 0x50c1df in main /tmp/360tools/build/x86_linux/../../app/360tools_conv/360tools_conv.c:369:9
    #3 0x7f1f0ca67680 in __libc_start_main /var/tmp/portage/sys-libs/glibc-2.23-r4/work/glibc-2.23/csu/../csu/libc-start.c:289

SUMMARY: AddressSanitizer: memcpy-param-overlap /var/tmp/portage/sys-libs/compiler-rt-sanitizers-4.0.1/work/compiler-rt-4.0.1.src/lib/asan/asan_interceptors.cc:453 in __asan_memcpy
==155340==ABORTING

It is reproducible here with any file, i.e. no special crafted file needed.