Notes
This function is in beta test. Please help improve it in the issues
here.
$ ./ex3_memory_check rand_int.txt inc main.c:156:13: runtime error: index 2049 out of bounds for type 'int [2049]' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior main.c:156:13 in ================================================================= ==29497==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffe0ccdad04 at pc 0x0000005174eb bp 0x7ffe0ccd4310 sp 0x7ffe0ccd4308 WRITE of size 4 at 0x7ffe0ccdad04 thread T0 #0 0x5174ea (/out/package/ex3_memory_check+0x5174ea) #1 0x517ed8 (/out/package/ex3_memory_check+0x517ed8) #2 0x7fc7d78dbb96 (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #3 0x41cac9 (/out/package/ex3_memory_check+0x41cac9) Address 0x7ffe0ccdad04 is located in stack of thread T0 at offset 27108 in frame #0 0x516d5f (/out/package/ex3_memory_check+0x516d5f) This frame has 5 object(s): [32, 40) 'temp' [64, 2113) 'task' [2256, 18648) 'content' [18912, 27108) 'a' <== Memory access at offset 27108 overflows this variable [27376, 43768) 'b' HI
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
Program exit with non zero value 1!
JOJ Answer
Correct!