<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi All,<br>
    <br>
    Please review a fix for jdk9<br>
    Bug: <a class="moz-txt-link-freetext" href="https://bugs.openjdk.java.net/browse/JDK-7160052">https://bugs.openjdk.java.net/browse/JDK-7160052</a><br>
    webrev: <a class="moz-txt-link-freetext" href="http://cr.openjdk.java.net/~psadhukhan/7160052/webrev.00/">http://cr.openjdk.java.net/~psadhukhan/7160052/webrev.00/</a><br>
    <br>
    Issue:<br>
    GlyphVector.setGlyphPosition(int glyphIndex, <a
      href="cid:part1.01090803.05010309@oracle.com" title="class in
      java.awt.geom">Point2D</a> newPos) can have glyphIndex "equal" to
    the number of glyphs in this GlyphVector<br>
    so if user tries to call
    GlyphVector.setGlyphPosition(gv.getNumGlyphs(),
    gv.getGlyphPosition(gv.getNumGlyphs()) it throws
    IndexOutOfBoundsException<br>
    <br>
    Cause:<br>
    StandardGlyphVector maintains a glyph cache for the glyphs stored in
    the GlyphVector via lbcache = new Shape[glyphs.length];<br>
    <br>
    When GlyphVector.setGlyphPosition() is called, it positions the
    glyph at the specified glyphIndex<code></code><code></code><code></code><code></code><code></code>
    and tries to clear the mentioned glyphIndex position of cache by
    calling clearCache(glyphIndex)<br>
    But, if we pass the glyphIndex == number of glyphs, then it tries to
    access beyond the cache array resulting in IOB.<br>
    <br>
    Fix:<br>
    Checked if glyphIndex passed as argument is equal to number of
    glyphs then do not try to clear the cache as setGlyphPosition() will
    anyway sets the position after the last glyph.<br>
    Also, added this check as per spec<code><a
        href="cid:part2.03060502.08060102@oracle.com" title="class in
        java.lang"> IndexOutOfBoundsException</a></code> - if <code>glyphIndex</code>
    is less than 0 or greater than the number of glyphs in this <code>GlyphVector<br>
    </code><br>
    Regards<br>
    Prasanta<br>
    <br>
    <code></code><code></code>
  </body>
</html>