Notes
This function is in beta test. Please help improve it in the issues
here.
================================================================= ==31085==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6060000000bc at pc 0x564e9eed99c4 bp 0x7ffdfd85b900 sp 0x7ffdfd85b8f0 READ of size 4 at 0x6060000000bc thread T0 #0 0x564e9eed99c3 in intMatrix::fillFrom(std::vector<int, std::allocator<int> >&) (/out/package/ex3+0x179c3) #1 0x564e9eed3c4d in main (/out/package/ex3+0x11c4d) #2 0x7fe7d67aeb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #3 0x564e9eed1639 in _start (/out/package/ex3+0xf639) 0x6060000000bc is located 0 bytes to the right of 60-byte region [0x606000000080,0x6060000000bc) allocated by thread T0 here: #0 0x7fe7d7f20448 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0448) #1 0x564e9eed8e72 in __gnu_cxx::new_allocator<int>::allocate(unsigned long, void const*) (/out/package/ex3+0x16e72) #2 0x564e9eed8cb4 in std::allocator_traits<std::allocator<int> >::allocate(std::allocator<int>&, unsigned long)
Hints
Your answer may be identical to the JOJ answer in the first several lines.
However, the main problem you meet now is Runtime Error. And the exit code of your program is 1, which should be 0.
Please double check your code to solve this problem and try again.
Your Answer
Testing fillFrom 2: 4 pts Before filling: Matrix Information: rows: 3 cols: 5
JOJ Answer
Testing fillFrom 2: 4 pts Before filling: Matrix Information: rows: 3 cols: 5 Matrix[1][1] = -1