Possible bug in StackFrameInfo#getByteCodeIndex?

mandy chung mandy.chung at oracle.com
Mon Dec 11 21:53:17 UTC 2017


I filed https://bugs.openjdk.java.net/browse/JDK-8193325.   I can 
sponsor this patch for you.

--- a/src/java.base/share/classes/java/lang/StackFrameInfo.java
+++ b/src/java.base/share/classes/java/lang/StackFrameInfo.java
@@ -93,7 +93,7 @@
          if (isNativeMethod())
              return -1;

-        return bci;
+        return bci & 0xffff;
      }

Mandy

On 12/7/17 8:19 PM, David Lloyd wrote:
> I was doing some research related to AccessController, and I noted
> this code [1] in StackFrameInfo#getByteCodeIndex():
>
> @Override
> public int getByteCodeIndex() {
>      // bci not available for native methods
>      if (isNativeMethod())
>          return -1;
>
>      return bci;
> }
>
> Now bci is of type short, and given the spec of the method, should the
> return not be:
>
>      return bci & 0xffff;
>
> instead?  Else it would return wrong values for methods with more than
> 32767 bytecodes in them.
>
> [1] http://hg.openjdk.java.net/jdk/jdk/file/e3b6cb90d7ce/src/java.base/share/classes/java/lang/StackFrameInfo.java#l96
>



More information about the core-libs-dev mailing list