The following crafted iso causes an overflow in makedeltaiso
Command to reproduce:
makedeltaiso CRAFTED.iso CRAFTED.iso NEW.iso
Full trace:
ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000000032 at pc 0x000000421b4a bp 0x7ffe5ac9abf0 sp 0x7ffe5ac9abe8
READ of size 4 at 0x602000000032 thread T0
#0 0x421b49 in rpmoffs /root/drpm/deltarpm/rpmoffs.c:168
#1 0x403263 in main /root/drpm/deltarpm/makedeltaiso.c:587
#2 0x7efcd01431f6 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
#3 0x7efcd01432ab in __libc_start_main_impl ../csu/libc-start.c:381
#4 0x4057b0 in _start (/usr/bin/makedeltaiso+0x4057b0)
0x602000000032 is located 0 bytes to the right of 2-byte region [0x602000000030,0x602000000032)
allocated by thread T0 here:
#0 0x7efcd03ce4ff in __interceptor_malloc /var/tmp/portage/sys-devel/gcc-11.3.1_p20221209/work/gcc-11-20221209/libsanitizer/asan/asan_malloc_linux.cpp:145
#1 0x41e048 in rpmoffs /root/drpm/deltarpm/rpmoffs.c:137
#2 0x403263 in main /root/drpm/deltarpm/makedeltaiso.c:587
#3 0x7efcd01431f6 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
SUMMARY: AddressSanitizer: heap-buffer-overflow /root/drpm/deltarpm/rpmoffs.c:168 in rpmoffs
Shadow bytes around the buggy address:
0x0c047fff7fb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c047fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c047fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c047fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c047fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c047fff8000: fa fa 00 02 fa fa[02]fa fa fa fa fa fa fa fa fa
0x0c047fff8010: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc
==12731==ABORTING
The following crafted iso causes an overflow in
makedeltaiso
Command to reproduce:
Full trace:
Testcase attached here: file.zip
I tested the package at the following commit: https://github.com/rpm-software-management/deltarpm/commit/1e764732d53b51720f2faabb409462b1af7a8ca7