Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

global-buffer-overflow by default in unit test (diskfile_test) #20

Closed
asarubbo opened this issue Sep 4, 2023 · 2 comments
Closed

global-buffer-overflow by default in unit test (diskfile_test) #20

asarubbo opened this issue Sep 4, 2023 · 2 comments

Comments

@asarubbo
Copy link

asarubbo commented Sep 4, 2023

In addition to what reported to #19 , on 1.1.0, if compiled with AddressSanitizer the unit_tests.log hangs because of:

create input2.txt, write and read it.
=================================================================
==1769==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000000536969 at pc 0x00000043de01 bp 0x7ffee61a2ac0 sp 0x7ffee61a2290
READ of size 16 at 0x000000536969 thread T0
    #0 0x43de00 in __interceptor_fwrite /var/tmp/portage/sys-libs/compiler-rt-sanitizers-16.0.5/work/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:1205:16
    #1 0x518adc in DiskFile::Write(unsigned long, void const*, unsigned long, unsigned long) /var/tmp/portage/app-arch/par2cmdline-turbo-1.1.0/work/par2cmdline-turbo-1.1.0/src/diskfile.cpp:597:24
    #2 0x5072f2 in test2() /var/tmp/portage/app-arch/par2cmdline-turbo-1.1.0/work/par2cmdline-turbo-1.1.0/src/diskfile_test.cpp:457:18
    #3 0x50ea97 in main /var/tmp/portage/app-arch/par2cmdline-turbo-1.1.0/work/par2cmdline-turbo-1.1.0/src/diskfile_test.cpp:738:7
    #4 0x7f205434a676 in __libc_start_call_main /var/tmp/portage/sys-libs/glibc-2.37-r3/work/glibc-2.37/csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #5 0x7f205434a734 in __libc_start_main /var/tmp/portage/sys-libs/glibc-2.37-r3/work/glibc-2.37/csu/../csu/libc-start.c:360:3
    #6 0x41f9c0 in _start (/var/tmp/portage/app-arch/par2cmdline-turbo-1.1.0/work/par2cmdline-turbo-1.1.0/tests/diskfile_test+0x41f9c0)

0x000000536969 is located 55 bytes before global variable '.str.58' defined in '/var/tmp/portage/app-arch/par2cmdline-turbo-1.1.0/work/par2cmdline-turbo-1.1.0/src/diskfile_test.cpp:328' (0x5369a0) of size 14
  '.str.58' is ascii string 'Create failed'
0x000000536969 is located 0 bytes after global variable '.str.57' defined in '/var/tmp/portage/app-arch/par2cmdline-turbo-1.1.0/work/par2cmdline-turbo-1.1.0/src/diskfile_test.cpp:316' (0x536940) of size 41
  '.str.57' is ascii string 'diskfile_test test3 input2.txt is longer'
SUMMARY: AddressSanitizer: global-buffer-overflow /var/tmp/portage/sys-libs/compiler-rt-sanitizers-16.0.5/work/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:1205:16 in __interceptor_fwrite
Shadow bytes around the buggy address:
  0x000000536680: 05 f9 f9 f9 f9 f9 f9 f9 00 03 f9 f9 02 f9 f9 f9
  0x000000536700: 00 03 f9 f9 00 00 00 00 01 f9 f9 f9 f9 f9 f9 f9
  0x000000536780: 00 03 f9 f9 00 03 f9 f9 00 03 f9 f9 00 00 00 00
  0x000000536800: 00 04 f9 f9 f9 f9 f9 f9 00 00 f9 f9 00 00 f9 f9
  0x000000536880: 00 06 f9 f9 00 00 f9 f9 00 00 f9 f9 00 00 00 00
=>0x000000536900: 00 00 05 f9 f9 f9 f9 f9 00 00 00 00 00[01]f9 f9
  0x000000536980: f9 f9 f9 f9 00 06 f9 f9 00 00 02 f9 f9 f9 f9 f9
  0x000000536a00: 00 00 02 f9 f9 f9 f9 f9 00 07 f9 f9 00 03 f9 f9
  0x000000536a80: 00 00 f9 f9 00 00 00 00 02 f9 f9 f9 f9 f9 f9 f9
  0x000000536b00: 00 00 f9 f9 00 00 f9 f9 00 00 f9 f9 00 00 00 00
  0x000000536b80: 02 f9 f9 f9 f9 f9 f9 f9 00 00 00 00 06 f9 f9 f9
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
==1769==ABORTING
./tests/unit_tests: line 5:  1769 Aborted                 $PARBINARY
ERROR: /var/tmp/portage/app-arch/par2cmdline-turbo-1.1.0/work/par2cmdline-turbo-1.1.0/tests/diskfile_test failed.
FAIL tests/unit_tests (exit status: 1)
@animetosho
Copy link
Owner

Would you be able to test this with the upstream project, and if it occurs there, report the issue there?

Thanks!

@asarubbo
Copy link
Author

asarubbo commented Sep 4, 2023

reported, thanks

@animetosho animetosho closed this as not planned Won't fix, can't repro, duplicate, stale Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants