title: addressSanitizer: heap-buffer-overflow on address
body: <p>I am at the very beginning of learning C.</p>
  
  <p>I am trying to write a function to open a file, read a <code>BUFFER_SIZE</code>, store the content in an array, then track the character <code>'\n'</code> (because I want to get each line of the input).</p>
  
  <p>when I set the <code>BUFFER_SIZE</code> very large, I can get the first line. when I set the <code>BUFFER_SIZE</code> reasonably small (say, 42) which is not yet the end of the first line , it prints out some weird symbol at the end, but I guess it is some bug in my own code.</p>
  
  <p>however, when I set the <code>BUFFER_SIZE</code> very small, say = 10, and i use the <code>-fsanitizer=address</code> to check for memory leak. it throws a monster of error:</p>
  
  <pre><code>==90673==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000000fb at pc 0x000108868a95 bp 0x7fff573979a0 sp 0x7fff57397998
  READ of size 1 at 0x6020000000fb thread T0
  </code></pre>
  
  <p>If anyone can explain me in a general sense: </p>
  
  <ul>
  <li><p>what is fsanitizer=address flag? </p></li>
  <li><p>what is heap-buffer-overflow? </p></li>
  <li><p>what is address and thread? what is the flag to see the thread in colors on screen?</p></li>
  <li><p>and why it says 'read of size 1 at address.." ?</p></li>
  </ul>
  
  <p>i would really appreciate &lt;3</p>