flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-7516) HybridMemorySegment: do not allow copies into a read-only ByteBuffer
Date Wed, 01 Nov 2017 09:05:00 GMT

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

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

Github user NicoK commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4593#discussion_r148209947
  
    --- Diff: flink-core/src/main/java/org/apache/flink/core/memory/HybridMemorySegment.java
---
    @@ -306,6 +307,9 @@ public final void get(int offset, ByteBuffer target, int numBytes)
{
     		if ((offset | numBytes | (offset + numBytes)) < 0) {
     			throw new IndexOutOfBoundsException();
     		}
    +		if (target.isReadOnly()) {
    --- End diff --
    
    you are right - the non-direct buffers path is based on `ByteBuffer#array()` which will
throw a `ReadOnlyBufferException` for read-only buffers, so it really is enough in the direct
buffers code path where the `UNSAFE.copyMemory` is not checking the source pointer (how should
it?!)


> HybridMemorySegment: do not allow copies into a read-only ByteBuffer
> --------------------------------------------------------------------
>
>                 Key: FLINK-7516
>                 URL: https://issues.apache.org/jira/browse/FLINK-7516
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Core, Network
>    Affects Versions: 1.4.0
>            Reporter: Nico Kruber
>            Assignee: Nico Kruber
>            Priority: Major
>
> {{HybridMemorySegment#get(int, ByteBuffer, int)}} allows writing into a read-only {{ByteBuffer}}
but this operation should be forbidden.



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

Mime
View raw message