Notes
This function is in beta test. Please help improve it in the issues
here.
================================================================= ==49974==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffc09ec2f94 at pc 0x00000048e280 bp 0x7ffc09e3d850 sp 0x7ffc09e3d000 READ of size 101 at 0x7ffc09ec2f94 thread T0 #0 0x48e27f (/out/package/ex4+0x48e27f) #1 0x48e8f9 (/out/package/ex4+0x48e8f9) #2 0x51576b (/out/package/ex4+0x51576b) #3 0x514f97 (/out/package/ex4+0x514f97) #4 0x7f560f5d5b96 (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #5 0x41ca69 (/out/package/ex4+0x41ca69) Address 0x7ffc09ec2f94 is located in stack of thread T0 at offset 546388 in frame #0 0x5150af (/out/package/ex4+0x5150af) This frame has 5 object(s): [32, 546032) 's' (line 5) [546288, 546388) 's0' (line 5) [546432, 1628032) 'a' (line 5) <== Memory access at offset 546388 partially underflows this variable [1628288, 2709888) 'b' (line 5) [2710144, 3791744) 'c' (line 5) HINT: this may be a false positive if your program uses some custom stack unwind me
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
STDOUT START 1 41 -117 -37 48 -62 -85 -78 72 -110 98 -82 -77 7 110 43 -115 80 88 -37 62 89 75 -110 80 -144 -4 94 137 14 -36 -48 -22 -75 135 -79 8 119 74 -152 -64 -126 -122 22 153 -69 9 -57 -160 -70 -120 39 17 -6 -39 -93 -80 40 31 -107 109 22 143 0 114 -94 -51 -59 14 187 -65 101 -51 129 0 67 -41 -55 -27 55 -33 -96 -147 102 -108 -15 -17 -31 84 42 -32 -15 -87 -75 119 29 71 122 25 41 25 132 67 62 -15 -17 67 -185 22 74 -141 18 -86 147 3 21 115 11 30 -6 76 173 19 31 84 22 -91 -5 38 -57 -59 -101 -32 -46 39 -186 69 91 -81 -83 -112 112 133 63 -171 -49 51 102 2 84 -34 121 -4 -148 140 19 -6 -106 -10 27 16 -63 182 -61 97 95 -104 -98 -4 -79 -13 -79 46 -17 -96 -94 124 -26 -67 -155 -30 -39 -23 -80 23 -46 -138 -47 10 25 -15 -22 45 149 -107 -44 83 -15 -11 16 89 -21 -15 39 -40 20 -133 -38 -44 8 22 28 95 170 66 -41 43 -95 35 72 -22 -43 90 -80 158 -68 -38 71 31 138 -71 18 -118 -34 -70 27 15 -2 6 -91 55 53 82 -65 1 167 73 -117 -3 -100 132 6 50 -18 28 -43 -133 -106 -147 19 40 -28 -128 97 -51 -140 99 15 16 -120 3 -29 74 149 -38