You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by yew1eb <gi...@git.apache.org> on 2017/09/30 07:31:07 UTC

[GitHub] flink pull request #4754: [FLINK-7742] Fix array access might be out of boun...

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 <ye...@gmail.com>
Date:   2017-09-30T06:50:59Z

    fix array access might be out of bounds

----


---

[GitHub] flink issue #4754: [FLINK-7742][hotfix] Fix array access might be out of bou...

Posted by StephanEwen <gi...@git.apache.org>.
Github user StephanEwen commented on the issue:

    https://github.com/apache/flink/pull/4754
  
    Good catches, thanks.
    
    Merging this...


---

[GitHub] flink pull request #4754: [FLINK-7742][hotfix] Fix array access might be out...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/flink/pull/4754


---