<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    I don't understand why you need to recheck that left > 0.<br>
    Nothing can change it between the while loop check and your check<br>
    <br>
                         while (left > 0) {<br>
                             int nbytes = stream.read(block, off, left);<br>
    +                        if (nbytes == -1 && left > 0) {<br>
    +                            throw new IIOException("Invalid block
    length for " +<br>
    +                                    "LZW encoded image data");<br>
    +                        }<br>
                             off += nbytes;<br>
                             left -= nbytes;<br>
                         }<br>
    <br>
    Also in the test since you are printing<br>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <pre>  51         } catch (IIOException e) {
  52             // do nothing we expect IIOException but we should not
  53             // throw IndexOutOfBoundsException
  54             System.out.println(e.toString());
  55             System.out.println("Caught IIOException ignore it");</pre>
    <br>
    Maybe add "Test passed" to be extra clear !<br>
    <br>
    -phil.<br>
    <br>
    On 3/5/20, 6:15 PM, Jayathirth D v wrote:
    <blockquote
      cite="mid:DE688F8F-6F72-4F8F-B024-CA2B754E1394@ORACLE.COM"
      type="cite">
      <meta http-equiv="Context-Type" content="text/html; charset=utf-8">
      Hi Brian,
      <div><br>
      </div>
      <div>Thanks for the clarification and approval.</div>
      <div><br>
      </div>
      <div>@Others : Need one more review please take a look.</div>
      <div><br>
      </div>
      <div>Regards,</div>
      <div>Jay </div>
      <div>
        <div><br>
          <blockquote type="cite">
            <div>On 06-Mar-2020, at 2:05 AM, Brian Burkhalter <<a
                moz-do-not-send="true"
                href="mailto:brian.burkhalter@oracle.com">brian.burkhalter@oracle.com</a>>
              wrote:</div>
            <br>
            <div>
              <div>Hi Jay,
                <div><br>
                </div>
                <div>I think the overall change is fine.</div>
                <div><br>
                </div>
                <div>Regards,</div>
                <div><br>
                </div>
                <div>Brian<br>
                  <div><br>
                    <blockquote type="cite">
                      <div>On Mar 5, 2020, at 9:18 AM, Jayathirth D v
                        <<a moz-do-not-send="true"
                          href="mailto:JAYATHIRTH.D.V@ORACLE.COM">JAYATHIRTH.D.V@ORACLE.COM</a>>
                        wrote:</div>
                      <br>
                      <div>
                        <div>
                          <div>Hello Brian,</div>
                          <div><br>
                          </div>
                          <div>Thanks for the review. GIF stream in
                            regression test case would match warn.gif
                            stream behaviour that’s why it going into
                            GIFImageReader.getCode().</div>
                          <div><br>
                          </div>
                          <div>Are you okay with overall webrev.00 patch
                            or have you just approved GIFImageReader
                            change? Please clarify.</div>
                          <div><br>
                          </div>
                          <div>Regards,</div>
                          <div>Jay<br>
                            <div><br>
                              <blockquote type="cite">
                                <div>On 05-Mar-2020, at 10:20 PM, Brian
                                  Burkhalter <<a
                                    moz-do-not-send="true"
                                    href="mailto:brian.burkhalter@oracle.com">brian.burkhalter@oracle.com</a>>
                                  wrote:</div>
                                <br>
                                <div>
                                  <div>Hello Jay,
                                    <div><br>
                                    </div>
                                    <div>The source fix looks OK to me.
                                      I get the same exception as in the
                                      bug description when I run the
                                      test against my unpatched local
                                      JDK 15 build.</div>
                                    <div><br>
                                    </div>
                                    <div>Thanks,</div>
                                    <div><br>
                                    </div>
                                    <div>Brian</div>
                                    <div>
                                      <div><br>
                                        <blockquote type="cite">
                                          <div>On Mar 5, 2020, at 2:12
                                            AM, Jayathirth D v <<a
                                              moz-do-not-send="true"
                                              href="mailto:JAYATHIRTH.D.V@ORACLE.COM">JAYATHIRTH.D.V@ORACLE.COM</a>>
                                            wrote:</div>
                                          <br>
                                          <div>
                                            <div>Please review the
                                              following fix for JDK 15:</div>
                                            <div><br>
                                            </div>
                                            <div>Bug : <a
                                                moz-do-not-send="true"
                                                href="https://bugs.openjdk.java.net/browse/JDK-6532025">https://bugs.openjdk.java.net/browse/JDK-6532025</a></div>
                                            <div>Webrev : <a
                                                moz-do-not-send="true"
                                                href="http://cr.openjdk.java.net/%7Ejdv/6532025/webrev.00/">http://cr.openjdk.java.net/~jdv/6532025/webrev.00/</a> </div>
                                            <div><br>
                                            </div>
                                            <div>Root cause : When we
                                              have truncated GIF images,
                                              stream.read() returns -1
                                              but GIFImageReader doesn’t
                                              handle such conditions
                                              properly and continues to
                                              read input stream data.</div>
                                            <div>Solution : Handle cases
                                              where we reach EOF and
                                              throw appropriate
                                              exception.</div>
                                          </div>
                                        </blockquote>
                                      </div>
                                      <br>
                                    </div>
                                  </div>
                                </div>
                              </blockquote>
                            </div>
                            <br>
                          </div>
                        </div>
                      </div>
                    </blockquote>
                  </div>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
  </body>
</html>