title: Getting AddressSanitizer error when I am trying to run my code
body: <p>This is a leet code problem which I am trying to solve <a href="https://leetcode.com/problems/container-with-most-water/" rel="nofollow noreferrer">https://leetcode.com/problems/container-with-most-water/</a>
  Below is the code which is running on my ide but i am not able to run this code. There it is showing AddressSanitizer error. Please help me to resolve this problem</p>
  <pre><code>    class Solution 
  {
    public:
      int maxArea(vector&lt;int&gt;&amp; height) 
      {
          int n=height.size(),product=1;
          int i=0,j=n-1;
          while(i&lt;j)
          {
              int x=(height[i]&lt;height[j])?height[i]:height[j];
              int y=j-i;
              int p=x*y;
              if(product&lt;p)
                  product=p;
              while(height[i]&lt;=height[j])
                  i++;
              while(height[i]&gt;height[j])
                  j--;
          }
          return product;
      }
  };
  </code></pre>
  <blockquote>
  <p>=================================================================
  ==31==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x606000000060 at pc 0x0000003760a2 bp 0x7ffc947d7160 sp
  0x7ffc947d7158 READ of size 4 at 0x606000000060 thread T0
  #3 0x7f4235b5f0b2  (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) 0x606000000060 is located 0 bytes to the right of 64-byte region
  [0x606000000020,0x606000000060) allocated by thread T0 here:
  #10 0x7f4235b5f0b2  (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) Shadow bytes around the buggy address:   0x0c0c7fff7fb0: 00 00 00 00
  00 00 00 00 00 00 00 00 00 00 00 00   0x0c0c7fff7fc0: 00 00 00 00 00
  00 00 00 00 00 00 00 00 00 00 00   0x0c0c7fff7fd0: 00 00 00 00 00 00
  00 00 00 00 00 00 00 00 00 00   0x0c0c7fff7fe0: 00 00 00 00 00 00 00
  00 00 00 00 00 00 00 00 00   0x0c0c7fff7ff0: 00 00 00 00 00 00 00 00
  00 00 00 00 00 00 00 00
  =&gt;0x0c0c7fff8000: fa fa fa fa 00 00 00 00 00 00 00 00[fa]fa fa fa   0x0c0c7fff8010: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa<br />
  0x0c0c7fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa<br />
  0x0c0c7fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa<br />
  0x0c0c7fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa<br />
  0x0c0c7fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa</p>
  </blockquote>