Notes
This function is in beta test. Please help improve it in the issues
here.
================================================================= ==2611==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60600000001c at pc 0x55ac6d27fc10 bp 0x7fff63580960 sp 0x7fff63580950 READ of size 4 at 0x60600000001c thread T0 #0 0x55ac6d27fc0f in LRUCache::read(int) (/out/package/cache_mem+0x4c0f) #1 0x55ac6d27dae5 in main (/out/package/cache_mem+0x2ae5) #2 0x7f439d244b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #3 0x55ac6d27f3e9 in _start (/out/package/cache_mem+0x43e9) 0x60600000001c is located 4 bytes to the left of 64-byte region [0x606000000020,0x606000000060) allocated by thread T0 here: #0 0x7f439dc95608 in operator new[](unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0608) #1 0x55ac6d27f576 in LRUCache::LRUCache(int, int) (/out/package/cache_mem+0x4576) SUMMARY: AddressSanitizer: heap-buffer-overflow (/out/package/cache_mem+0x4c0f) in LRUCache::read(int) Shadow bytes around the buggy address: 0x0c0c7fff7fb0: 00 00 00 00 0
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
JOJ Answer
ERROR: Address out of bound 0 0 ERROR: Address out of bound 15 0 0 0 7 8 5 6 0 2 0 4 0 0 0 0 0 0 0 0 0 0 0 0 ERROR: Address out of bound ERROR: Address out of bound ERROR: Address out of bound ERROR: Address out of bound ERROR: Address out of bound ERROR: Address out of bound ERROR: Address out of bound ERROR: Address out of bound 15 16 13 14 11 12 9 10 0 2 0 4 0 6 0 8 0 0 0 0 0 0 0 0