[ 
https://issues.apache.org/jira/browse/FLINK-7742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16186962#comment-16186962
 ] 

ASF GitHub Bot commented on FLINK-7742:
---------------------------------------

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

    fix array access might be out of bounds

----


> Fix array access might be out of bounds
> ---------------------------------------
>
>                 Key: FLINK-7742
>                 URL: https://issues.apache.org/jira/browse/FLINK-7742
>             Project: Flink
>          Issue Type: Bug
>          Components: Build System
>    Affects Versions: 1.3.2
>            Reporter: Hai Zhou UTC+8
>            Assignee: Hai Zhou UTC+8
>             Fix For: 1.4.0
>
>




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to