You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "James Peach (JIRA)" <ji...@apache.org> on 2016/11/09 18:36:59 UTC
[jira] [Resolved] (TS-4927) Coverity issues in passthru example
plugin
[ https://issues.apache.org/jira/browse/TS-4927?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
James Peach resolved TS-4927.
-----------------------------
Resolution: Fixed
> Coverity issues in passthru example plugin
> ------------------------------------------
>
> Key: TS-4927
> URL: https://issues.apache.org/jira/browse/TS-4927
> Project: Traffic Server
> Issue Type: Bug
> Components: Plugins
> Reporter: Leif Hedstrom
> Assignee: James Peach
> Fix For: 7.1.0
>
>
> {code}
> *** CID 1363659: Null pointer dereferences (REVERSE_INULL)
> /example/passthru/passthru.cc: 214 in PassthruSessionEvent(tsapi_cont *, TSEvent, void *)()
> 208
> 209 // Start the server end of the IO before we write any data.
> 210 sp->server.readio.read(sp->server.vconn, sp->contp);
> 211 sp->server.writeio.write(sp->server.vconn, sp->contp);
> 212 }
> 213
> CID 1363659: Null pointer dereferences (REVERSE_INULL)
> Null-checking "sp->server.vconn" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
> 214 if (sp->server.vconn != nullptr) {
> 215 int64_t nbytes;
> 216
> 217 nbytes = sp->client.readio.transfer_to(sp->server.writeio);
> 218 PassthruSessionDebug(sp, "proxied %" PRId64 " bytes from client vconn=%p to server vconn=%p", nbytes, sp->client.vconn,
> 219 sp->server.vconn);
> ** CID 1363658: Incorrect expression (ASSERT_SIDE_EFFECT)
> /example/passthru/passthru.cc: 97 in PassthruIO::write(tsapi_cont *, tsapi_cont *)()
> ________________________________________________________________________________________________________
> *** CID 1363658: Incorrect expression (ASSERT_SIDE_EFFECT)
> /example/passthru/passthru.cc: 97 in PassthruIO::write(tsapi_cont *, tsapi_cont *)()
> 91 void
> 92 write(TSVConn vconn, TSCont contp)
> 93 {
> 94 TSReleaseAssert(this->vio == NULL);
> 95
> 96 TSReleaseAssert((this->iobuf = TSIOBufferCreate()));
> CID 1363658: Incorrect expression (ASSERT_SIDE_EFFECT)
> Assignment "this->reader = TSIOBufferReaderAlloc(this->iobuf)" has a side effect. This code will work differently in a non-debug build.
> 97 TSReleaseAssert((this->reader = TSIOBufferReaderAlloc(this->iobuf)));
> 98
> 99 this->vio = TSVConnWrite(vconn, contp, this->reader, INT64_MAX);
> 100 }
> 101
> 102 // Transfer data from this IO object to the target IO object.
> ** CID 1363657: Incorrect expression (ASSERT_SIDE_EFFECT)
> /example/passthru/passthru.cc: 84 in PassthruIO::read(tsapi_cont *, tsapi_cont *)()
> ________________________________________________________________________________________________________
> *** CID 1363657: Incorrect expression (ASSERT_SIDE_EFFECT)
> /example/passthru/passthru.cc: 84 in PassthruIO::read(tsapi_cont *, tsapi_cont *)()
> 78 // Start a read operation.
> 79 void
> 80 read(TSVConn vconn, TSCont contp)
> 81 {
> 82 TSReleaseAssert(this->vio == NULL);
> 83
> CID 1363657: Incorrect expression (ASSERT_SIDE_EFFECT)
> Assignment "this->iobuf = TSIOBufferCreate()" has a side effect. This code will work differently in a non-debug build.
> 84 TSReleaseAssert((this->iobuf = TSIOBufferCreate()));
> 85 TSReleaseAssert((this->reader = TSIOBufferReaderAlloc(this->iobuf)));
> 86
> 87 this->vio = TSVConnRead(vconn, contp, this->iobuf, INT64_MAX);
> 88 }
> 89
> ** CID 1363656: Incorrect expression (ASSERT_SIDE_EFFECT)
> /example/passthru/passthru.cc: 96 in PassthruIO::write(tsapi_cont *, tsapi_cont *)()
> ________________________________________________________________________________________________________
> *** CID 1363656: Incorrect expression (ASSERT_SIDE_EFFECT)
> /example/passthru/passthru.cc: 96 in PassthruIO::write(tsapi_cont *, tsapi_cont *)()
> 90 // Start a write operation.
> 91 void
> 92 write(TSVConn vconn, TSCont contp)
> 93 {
> 94 TSReleaseAssert(this->vio == NULL);
> 95
> CID 1363656: Incorrect expression (ASSERT_SIDE_EFFECT)
> Assignment "this->iobuf = TSIOBufferCreate()" has a side effect. This code will work differently in a non-debug build.
> 96 TSReleaseAssert((this->iobuf = TSIOBufferCreate()));
> 97 TSReleaseAssert((this->reader = TSIOBufferReaderAlloc(this->iobuf)));
> 98
> 99 this->vio = TSVConnWrite(vconn, contp, this->reader, INT64_MAX);
> 100 }
> 101
> ** CID 1363655: Incorrect expression (ASSERT_SIDE_EFFECT)
> /example/passthru/passthru.cc: 85 in PassthruIO::read(tsapi_cont *, tsapi_cont *)()
> ________________________________________________________________________________________________________
> *** CID 1363655: Incorrect expression (ASSERT_SIDE_EFFECT)
> /example/passthru/passthru.cc: 85 in PassthruIO::read(tsapi_cont *, tsapi_cont *)()
> 79 void
> 80 read(TSVConn vconn, TSCont contp)
> 81 {
> 82 TSReleaseAssert(this->vio == NULL);
> 83
> 84 TSReleaseAssert((this->iobuf = TSIOBufferCreate()));
> CID 1363655: Incorrect expression (ASSERT_SIDE_EFFECT)
> Assignment "this->reader = TSIOBufferReaderAlloc(this->iobuf)" has a side effect. This code will work differently in a non-debug build.
> 85 TSReleaseAssert((this->reader = TSIOBufferReaderAlloc(this->iobuf)));
> 86
> 87 this->vio = TSVConnRead(vconn, contp, this->iobuf, INT64_MAX);
> 88 }
> 89
> 90 // Start a write operation.
> ** CID 1363654: Incorrect expression (ASSERT_SIDE_EFFECT)
> /example/passthru/passthru.cc: 327 in PassthruListen()()
> ________________________________________________________________________________________________________
> *** CID 1363654: Incorrect expression (ASSERT_SIDE_EFFECT)
> /example/passthru/passthru.cc: 327 in PassthruListen()()
> 321 return TS_ERROR;
> 322 }
> 323
> 324 TSDebug(PLUGIN_NAME, "listening on port '%s'", ports);
> 325 TSfree(ports);
> 326
> CID 1363654: Incorrect expression (ASSERT_SIDE_EFFECT)
> Assignment "cont = TSContCreate(PassthruAccept, NULL)" has a side effect. This code will work differently in a non-debug build.
> 327 TSReleaseAssert(cont = TSContCreate(PassthruAccept, nullptr));
> 328 return TSPortDescriptorAccept(descriptor, cont);
> 329 }
> 330
> 331 void
> 332 TSPluginInit(int /* argc */, const char * /* argv */ [])
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)