title: Accessing a string out of bounds does not trigger any valgrind/ASAN/UBSAN warnings
body: <p>I have this code:</p>
  <pre><code>static int main(string[] args) {
          info(escape_latex(args[1]));
          return 0;
  }
  string escape_latex(string input) {
          var builder = new StringBuilder.sized(input.length + 20);
          var map = new Gee.HashMap&lt;string, string&gt;();
          // ...&lt;Snip&gt;...
          // Fix for some weird unicode bugs
          map[&quot;\xff\xbf\xbf\xbf\xbf\xbf&quot;] = &quot;&quot;;
          info(&quot;Len: %d&quot;, input.char_count());
          for(var i = 0; i &lt; input.char_count(); i++) {
                  var ic = input.get_char(i);
                  var as_string = ic.to_string();
                  info(&quot;%d %s&quot;, i, as_string);
                  if(map.has_key(as_string)) {
                          builder.append(map[as_string]);
                  } else {
                          builder.append_unichar(ic);
                  }
          }
          return builder.str;
  }
  </code></pre>
  <p>If I pass &quot;foo123&quot;, I get the expected output &quot;foo123&quot;. But If I pass &quot;Geldbeutel+Schlüsselanhänger&quot;, I get the output &quot;Geldbeutel+Schl?sselanh?ng&quot; (Last two chars are missing).</p>
  <p>Now I changed the for-loop to <code>for(var i = 0; i &lt;= input.char_count(); i++) {</code></p>
  <p>For &quot;foo123&quot;, I get the expected output, for &quot;Geldbeutel+Schlüsselanhänger&quot;, I get &quot;Geldbeutel+Schl?sselanh?nge&quot;. (Valgrind, ASAN and UBSAN don't show anything).</p>
  <p>Now I change the for-loop to <code>for(var i = 0; i &lt;= input.char_count() + 1; i++) {</code></p>
  <p>&quot;foo123&quot; is now <code>foo123G</code>, as I run over into other memory, but &quot;Geldbeutel+Schlüsselanhänger&quot; give the correct output &quot;Geldbeutel+Schl?sselAnh?nger&quot;</p>
  <p>For the last example input, an example output:</p>
  <pre><code>** INFO: 19:41:57.903: a.vala:23: Len: 28
  ** INFO: 19:41:57.903: a.vala:29: 0 G
  ** INFO: 19:41:57.903: a.vala:29: 1 e
  ** INFO: 19:41:57.903: a.vala:29: 2 l
  ** INFO: 19:41:57.903: a.vala:29: 3 d
  ** INFO: 19:41:57.903: a.vala:29: 4 b
  ** INFO: 19:41:57.903: a.vala:29: 5 e
  ** INFO: 19:41:57.903: a.vala:29: 6 u
  ** INFO: 19:41:57.903: a.vala:29: 7 t
  ** INFO: 19:41:57.903: a.vala:29: 8 e
  ** INFO: 19:41:57.903: a.vala:29: 9 l
  ** INFO: 19:41:57.903: a.vala:29: 10 +
  ** INFO: 19:41:57.903: a.vala:29: 11 S
  ** INFO: 19:41:57.903: a.vala:29: 12 c
  ** INFO: 19:41:57.903: a.vala:29: 13 h
  ** INFO: 19:41:57.903: a.vala:29: 14 l
  ** INFO: 19:41:57.903: a.vala:29: 15 ?
  ** INFO: 19:41:57.903: a.vala:29: 17 s
  ** INFO: 19:41:57.903: a.vala:29: 18 s
  ** INFO: 19:41:57.903: a.vala:29: 19 e
  ** INFO: 19:41:57.903: a.vala:29: 20 l
  ** INFO: 19:41:57.903: a.vala:29: 21 a
  ** INFO: 19:41:57.903: a.vala:29: 22 n
  ** INFO: 19:41:57.903: a.vala:29: 23 h
  ** INFO: 19:41:57.903: a.vala:29: 24 ?
  ** INFO: 19:41:57.903: a.vala:29: 26 n
  ** INFO: 19:41:57.903: a.vala:29: 27 g
  ** INFO: 19:41:57.903: a.vala:29: 28 e
  ** INFO: 19:41:57.903: a.vala:29: 29 r            // &lt;- Here, I access an invalid index, but it works
  ** INFO: 19:41:57.903: a.vala:2: Geldbeutel+Schl?sselanh?nger
  </code></pre>
  <p>It seems to be related to unicode, but I can't find a way to make this function work.</p>