You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2017/05/10 19:20:32 UTC
[trafficserver] branch master updated: Coverity CID #1374942
Out-of-bounds access
This is an automated email from the ASF dual-hosted git repository.
sorber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 5f095f2 Coverity CID #1374942 Out-of-bounds access
5f095f2 is described below
commit 5f095f2d72ee564e0effde3f52eeeb21723001ca
Author: Phil Sorber <so...@apache.org>
AuthorDate: Wed May 10 09:24:25 2017 -0600
Coverity CID #1374942 Out-of-bounds access
---
iocore/aio/AIO.cc | 2 +-
iocore/aio/I_AIO.h | 10 ++++++++--
iocore/aio/P_AIO.h | 14 +++++---------
iocore/eventsystem/I_Action.h | 8 +++-----
4 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/iocore/aio/AIO.cc b/iocore/aio/AIO.cc
index e3cf06d..7651bfe 100644
--- a/iocore/aio/AIO.cc
+++ b/iocore/aio/AIO.cc
@@ -553,7 +553,7 @@ Lagain:
Debug("aio", "io_getevents failed: %s (%d)", strerror(-ret), -ret);
}
- ink_aiocb_t *cbs[MAX_AIO_EVENTS];
+ ink_aiocb *cbs[MAX_AIO_EVENTS];
int num = 0;
for (; num < MAX_AIO_EVENTS && ((op = ready_list.dequeue()) != nullptr); ++num) {
diff --git a/iocore/aio/I_AIO.h b/iocore/aio/I_AIO.h
index e1a87e1..2a5e9e1 100644
--- a/iocore/aio/I_AIO.h
+++ b/iocore/aio/I_AIO.h
@@ -96,13 +96,19 @@ struct AIOCallback : public Continuation {
// set before calling aio_read/aio_write
ink_aiocb aiocb;
Action action;
- EThread *thread = nullptr;
+ EThread *thread = AIO_CALLBACK_THREAD_ANY;
AIOCallback *then = nullptr;
// set on return from aio_read/aio_write
int64_t aio_result = 0;
int ok();
- AIOCallback() : thread(AIO_CALLBACK_THREAD_ANY), then(0) { aiocb.aio_reqprio = AIO_DEFAULT_PRIORITY; }
+ AIOCallback()
+ {
+ aiocb.aio_reqprio = AIO_DEFAULT_PRIORITY;
+#if AIO_MODE == AIO_MODE_NATIVE
+ memset((void *)&(this->aiocb), 0, sizeof(this->aiocb));
+#endif
+ }
};
#if AIO_MODE == AIO_MODE_NATIVE
diff --git a/iocore/aio/P_AIO.h b/iocore/aio/P_AIO.h
index 259dfec..3637ef6 100644
--- a/iocore/aio/P_AIO.h
+++ b/iocore/aio/P_AIO.h
@@ -96,16 +96,12 @@ AIOVec::mainEvent(int /* event */, Event *)
struct AIO_Reqs;
struct AIOCallbackInternal : public AIOCallback {
- AIOCallback *first;
- AIO_Reqs *aio_req;
- ink_hrtime sleep_time;
+ AIOCallback *first = nullptr;
+ AIO_Reqs *aio_req = nullptr;
+ ink_hrtime sleep_time = 0;
int io_complete(int event, void *data);
- AIOCallbackInternal()
- {
- const size_t to_zero = sizeof(AIOCallbackInternal) - (size_t) & (((AIOCallbackInternal *)0)->aiocb);
- memset((char *)&(this->aiocb), 0, to_zero);
- SET_HANDLER(&AIOCallbackInternal::io_complete);
- }
+
+ AIOCallbackInternal() { SET_HANDLER(&AIOCallbackInternal::io_complete); }
};
TS_INLINE int
diff --git a/iocore/eventsystem/I_Action.h b/iocore/eventsystem/I_Action.h
index 711eb81..847145e 100644
--- a/iocore/eventsystem/I_Action.h
+++ b/iocore/eventsystem/I_Action.h
@@ -97,7 +97,7 @@ public:
directly by the state machine.
*/
- Continuation *continuation;
+ Continuation *continuation = nullptr;
/**
Reference to the Continuation's lock.
@@ -119,7 +119,7 @@ public:
machine.
*/
- volatile int cancelled;
+ volatile int cancelled = false;
/**
Cancels the asynchronous operation represented by this action.
@@ -187,10 +187,8 @@ public:
Continuation.
*/
- Action() : continuation(nullptr), cancelled(false) {}
-#if defined(__GNUC__)
+ Action() {}
virtual ~Action() {}
-#endif
};
#define ACTION_RESULT_NONE MAKE_ACTION_RESULT(0)
--
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].