GitHub user yew1eb opened a pull request:
https://github.com/apache/flink/pull/4754
[FLINK-7742] Fix array access might be out of bounds
org.apache.flink.api.java.Utils.java
```
public static String getCallLocationName(int depth) {
StackTraceElement[] stackTrace =
Thread.currentThread().getStackTrace();
if (stackTrace.length <= depth) {
return "<unknown>";
}
StackTraceElement elem = stackTrace[depth];
return String.format("%s(%s:%d)", elem.getMethodName(),
elem.getFileName(), elem.getLineNumber());
}
```
if depth equals stackTrace.length then `stackTrace[depth];` will out of
bounds.
org.apache.flink.runtime.query.netty.message.KvStateRequestSerializer
```
public static KvStateRequestType deserializeHeader(ByteBuf buf) {
// Check the version
int version = buf.readInt();
if (version != VERSION) {
throw new IllegalArgumentException("Illegal message
version " + version +
". Expected: " + VERSION + ".");
}
// Get the message type
int msgType = buf.readInt();
KvStateRequestType[] values = KvStateRequestType.values();
if (msgType >= 0 && msgType <= values.length) {
return values[msgType];
} else {
throw new IllegalArgumentException("Illegal message
type with index " + msgType);
}
}
```
if msgType equals values.length then `return values[msgType]` will out of
bounds.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/yew1eb/flink master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/4754.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #4754
----
commit 0343da3b9d16b08ed91ff1800113fcd8ca200cba
Author: yew1eb <[email protected]>
Date: 2017-09-30T06:50:59Z
fix array access might be out of bounds
----
---