这个问题是我之前的问题的续集,目前的状态是我已经获得了地址消毒剂的输出——由@Employed Russian 建议——如下所示。这是我第一次使用地址消毒剂,所以请原谅我的幼稚。
==2596== ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fff89d67fd0 at pc 0x401f21 bp 0x7fff89d67d00 sp 0x7fff89d67cf8
READ of size 4 at 0x7fff89d67fd0 thread T0
#0 0x401f20 (/home/ubuntu/tp+0x401f20)
#1 0x405bac (/home/ubuntu/tp+0x405bac)
#2 0x406d40 (/home/ubuntu/tp+0x406d40)
#3 0x7fb5a7d6fec4 (/lib/x86_64-linux-gnu/libc-2.19.so+0x21ec4)
#4 0x401278 (/home/ubuntu/tp+0x401278)
Address 0x7fff89d67fd0 is located at offset 320 in frame <TMV_multiplication> of T0's stack:
This frame has 13 object(s):
[32, 60) 'A11_Upper_matrix'
[96, 124) 'A_Upper_matrix'
[160, 192) 'A11_Lower_matrix'
[224, 256) 'A_Lower_matrix'
[288, 320) 'VecA'
[352, 384) 'VecB'
[416, 448) 'VecC'
[480, 536) 'result_A_Upper'
[576, 632) 'result_C_Upper'
[672, 732) 'matrix_A21'
[768, 832) 'result_A_Lower'
[864, 928) 'result_B'
[960, 1024) 'result_C_Lower'
HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext
(longjmp and C++ exceptions *are* supported)
Shadow bytes around the buggy address:
0x1000713a4fa0: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1
0x1000713a4fb0: 00 00 f4 f4 f2 f2 f2 f2 00 00 00 04 f2 f2 f2 f2
0x1000713a4fc0: 00 00 00 00 f3 f3 f3 f3 00 00 00 00 00 00 00 00
0x1000713a4fd0: 00 00 f1 f1 f1 f1 00 00 00 04 f2 f2 f2 f2 00 00
0x1000713a4fe0: 00 04 f2 f2 f2 f2 00 00 00 00 f2 f2 f2 f2 00 00
=>0x1000713a4ff0: 00 00 f2 f2 f2 f2 00 00 00 00[f2]f2 f2 f2 00 00
0x1000713a5000: 00 00 f2 f2 f2 f2 00 00 00 00 f2 f2 f2 f2 00 00
0x1000713a5010: 00 00 00 00 00 f4 f2 f2 f2 f2 00 00 00 00 00 00
0x1000713a5020: 00 f4 f2 f2 f2 f2 00 00 00 00 00 00 00 04 f2 f2
0x1000713a5030: f2 f2 00 00 00 00 00 00 00 00 f2 f2 f2 f2 00 00
0x1000713a5040: 00 00 00 00 00 00 f2 f2 f2 f2 00 00 00 00 00 00
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
Heap righ redzone: fb
Freed Heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
ASan internal: fe
==2596== ABORTING
正如@Employed Russian 早些时候指出的那样,问题很可能出在堆栈上。现在,如何解决这个堆栈问题?因为这些都在我头上。