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

ASF GitHub Bot commented on MINIFICPP-665:
------------------------------------------

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

    https://github.com/apache/nifi-minifi-cpp/pull/435#discussion_r232960242
  
    --- Diff: libminifi/src/io/BaseStream.cpp ---
    @@ -143,15 +147,19 @@ int BaseStream::read(uint8_t *value, int len) {
      * @param buflen
      */
     int BaseStream::readData(std::vector<uint8_t> &buf, int buflen) {
    -  return Serializable::read(&buf[0], buflen, 
reinterpret_cast<DataStream*>(composable_stream_));
    +  return Serializable::read(&buf[0], buflen, composable_stream_);
     }
     /**
      * Reads data and places it into buf
      * @param buf buffer in which we extract data
      * @param buflen
      */
     int BaseStream::readData(uint8_t *buf, int buflen) {
    -  return Serializable::read(buf, buflen, 
reinterpret_cast<DataStream*>(composable_stream_));
    +  if (composable_stream_ == this) {
    --- End diff --
    
    Likely?


> Fix basestream references
> -------------------------
>
>                 Key: MINIFICPP-665
>                 URL: https://issues.apache.org/jira/browse/MINIFICPP-665
>             Project: NiFi MiNiFi C++
>          Issue Type: Improvement
>            Reporter: Mr TheSegfault
>            Assignee: Mr TheSegfault
>            Priority: Major
>
> At some point basestream was changed to be a composable pointer ( hence the 
> name base stream ) as a wrapper for a variety of streams. this caused a bug 
> where a self reference could occur. We overload this stream to be a self 
> reference since it extends DataStream. This is a very likely usage so we can 
> avoid the bugs by simply checking if the composition is a reference to self. 
> This reference to self won't be removed in the interest of time and re-using 
> Serializable's interface. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to