Describe the bug
I want to see if Dr Memory can analyse if an index is out of range inside an array.
To Reproduce
I used this C code.
int main() {
clock_t start, end;
float cpu_time_used;
start = clock();
int a[2] = {3, 5};
printf("a = %i", a[1]);
end = clock();
cpu_time_used = ((float) (end - start)) / CLOCKS_PER_SEC;
printf("\nTotal speed was %f\n", cpu_time_used);
return EXIT_SUCCESS;
}
I drag my .exe
file to Dr.Memory
file.
Expected behavior
I did not expect errors.
Screenshots or Pasted Text
Dr. Memory version 2.5.0 build 0 built on Oct 18 2021 03:01:22
Windows version: WinVer=105;Rel=2009;Build=22000;Edition=Professional
Dr. Memory results for pid 10616: "CControl.exe"
Application cmdline: ""C:\Users\dmn\OneDrive - ITH\Dokument\Projekt\Eclipse\CControl\Debug\CControl.exe""
Recorded 124 suppression(s) from default C:\Program Files (x86)\Dr. Memory\bin64\suppress-default.txt
Error #1: UNADDRESSABLE ACCESS beyond top of stack: reading 0x000000a30e7ff3e0-0x000000a30e7ff3e8 8 byte(s)
# 0 ___chkstk_ms [../../../../../src/gcc-11.2.0/libgcc/config/i386/cygwin.S:132]
# 1 _pei386_runtime_relocator
# 2 __tmainCRTStartup
# 3 .l_start
# 4 ntdll.dll!RtlUserThreadStart
Note: @0:00:00.095 in thread 19384
Note: 0x000000a30e7ff3e0 refers to 664 byte(s) beyond the top of the stack 0x000000a30e7ff678
Note: instruction: or $0x0000000000000000 (%rcx) -> (%rcx)
Error #2: UNADDRESSABLE ACCESS beyond top of stack: reading 0x000000a30e7ff4c0-0x000000a30e7ff4c8 8 byte(s)
# 0 ___chkstk_ms [../../../../../src/gcc-11.2.0/libgcc/config/i386/cygwin.S:132]
# 1 __pformat_int.isra.0 [../../../../../src/gcc-11.2.0/libgcc/config/i386/cygwin.S:138]
# 2 __mingw_pformat [../../../../../src/gcc-11.2.0/libgcc/config/i386/cygwin.S:138]
# 3 __mingw_vfprintf [../../../../../src/gcc-11.2.0/libgcc/config/i386/cygwin.S:138]
# 4 printf
# 5 main
Note: @0:00:00.128 in thread 19384
Note: 0x000000a30e7ff4c0 refers to 8 byte(s) beyond the top of the stack 0x000000a30e7ff4c8
Note: instruction: or $0x0000000000000000 (%rcx) -> (%rcx)
Error #3: POSSIBLE LEAK 98 direct bytes 0x000001cd66d701c0-0x000001cd66d70222 + 0 indirect bytes
# 0 replace_malloc [d:\a\drmemory\drmemory\common\alloc_replace.c:2580]
# 1 msvcrt.dll!malloc_crt
# 2 msvcrt.dll!_setargv
# 3 msvcrt.dll!_getmainargs
# 4 pre_cpp_init
# 5 msvcrt.dll!initterm
# 6 __tmainCRTStartup
# 7 .l_start
# 8 ntdll.dll!RtlUserThreadStart
===========================================================================
FINAL SUMMARY:
DUPLICATE ERROR COUNTS:
Error # 1: 2
Error # 2: 2
SUPPRESSIONS USED:
ERRORS FOUND:
2 unique, 4 total unaddressable access(es)
0 unique, 0 total uninitialized access(es)
0 unique, 0 total invalid heap argument(s)
0 unique, 0 total GDI usage error(s)
0 unique, 0 total handle leak(s)
0 unique, 0 total warning(s)
0 unique, 0 total, 0 byte(s) of leak(s)
1 unique, 1 total, 98 byte(s) of possible leak(s)
ERRORS IGNORED:
3 unique, 3 total, 113 byte(s) of still-reachable allocation(s)
(re-run with "-show_reachable" for details)
Details: C:\Users\dmn\AppData\Roaming\Dr. Memory\DrMemory-CControl.exe.10616.000\results.txt
If I use this code where the the index is out of range.
int main() {
clock_t start, end;
float cpu_time_used;
start = clock();
int a[2] = {3, 5};
printf("a = %i", a[2]);
end = clock();
cpu_time_used = ((float) (end - start)) / CLOCKS_PER_SEC;
printf("\nTotal speed was %f\n", cpu_time_used);
return EXIT_SUCCESS;
}
Dr Memory gives this output. As you can see, it's one more error. But not so much more information.
Dr. Memory version 2.5.0 build 0 built on Oct 18 2021 03:01:22
Windows version: WinVer=105;Rel=2009;Build=22000;Edition=Professional
Dr. Memory results for pid 3344: "CControl.exe"
Application cmdline: ""C:\Users\dmn\OneDrive - ITH\Dokument\Projekt\Eclipse\CControl\Debug\CControl.exe""
Recorded 124 suppression(s) from default C:\Program Files (x86)\Dr. Memory\bin64\suppress-default.txt
Error #1: UNADDRESSABLE ACCESS beyond top of stack: reading 0x0000006819dff7a0-0x0000006819dff7a8 8 byte(s)
# 0 ___chkstk_ms [../../../../../src/gcc-11.2.0/libgcc/config/i386/cygwin.S:132]
# 1 _pei386_runtime_relocator
# 2 __tmainCRTStartup
# 3 .l_start
# 4 ntdll.dll!RtlUserThreadStart
Note: @0:00:00.094 in thread 16516
Note: 0x0000006819dff7a0 refers to 664 byte(s) beyond the top of the stack 0x0000006819dffa38
Note: instruction: or $0x0000000000000000 (%rcx) -> (%rcx)
Error #2: UNADDRESSABLE ACCESS beyond top of stack: reading 0x0000006819dff880-0x0000006819dff888 8 byte(s)
# 0 ___chkstk_ms [../../../../../src/gcc-11.2.0/libgcc/config/i386/cygwin.S:132]
# 1 __pformat_int.isra.0 [../../../../../src/gcc-11.2.0/libgcc/config/i386/cygwin.S:138]
# 2 __mingw_pformat [../../../../../src/gcc-11.2.0/libgcc/config/i386/cygwin.S:138]
# 3 __mingw_vfprintf [../../../../../src/gcc-11.2.0/libgcc/config/i386/cygwin.S:138]
# 4 printf
# 5 main
Note: @0:00:00.123 in thread 16516
Note: 0x0000006819dff880 refers to 8 byte(s) beyond the top of the stack 0x0000006819dff888
Note: instruction: or $0x0000000000000000 (%rcx) -> (%rcx)
Error #3: UNINITIALIZED READ: reading register rcx
# 0 __pformat_int.isra.0 [../../../../../src/gcc-11.2.0/libgcc/config/i386/cygwin.S:138]
# 1 __mingw_pformat [../../../../../src/gcc-11.2.0/libgcc/config/i386/cygwin.S:138]
# 2 __mingw_vfprintf [../../../../../src/gcc-11.2.0/libgcc/config/i386/cygwin.S:138]
# 3 printf
# 4 main
Note: @0:00:00.124 in thread 16516
Note: instruction: test %rcx %rcx
Error #4: POSSIBLE LEAK 98 direct bytes 0x0000016e036c01c0-0x0000016e036c0222 + 0 indirect bytes
# 0 replace_malloc [d:\a\drmemory\drmemory\common\alloc_replace.c:2580]
# 1 msvcrt.dll!malloc_crt
# 2 msvcrt.dll!_setargv
# 3 msvcrt.dll!_getmainargs
# 4 pre_cpp_init
# 5 msvcrt.dll!initterm
# 6 __tmainCRTStartup
# 7 .l_start
# 8 ntdll.dll!RtlUserThreadStart
===========================================================================
FINAL SUMMARY:
DUPLICATE ERROR COUNTS:
Error # 1: 2
Error # 2: 2
SUPPRESSIONS USED:
ERRORS FOUND:
2 unique, 4 total unaddressable access(es)
1 unique, 1 total uninitialized access(es)
0 unique, 0 total invalid heap argument(s)
0 unique, 0 total GDI usage error(s)
0 unique, 0 total handle leak(s)
0 unique, 0 total warning(s)
0 unique, 0 total, 0 byte(s) of leak(s)
1 unique, 1 total, 98 byte(s) of possible leak(s)
ERRORS IGNORED:
3 unique, 3 total, 113 byte(s) of still-reachable allocation(s)
(re-run with "-show_reachable" for details)
Details: C:\Users\dmn\AppData\Roaming\Dr. Memory\DrMemory-CControl.exe.3344.000\results.txt
Versions
- Dr Memory 2.5.0
- Windows 11
Additional context