Hi Canh,

 

Log stream is allocated with brackets, (), going with new operator; It means
numOpeners field is already zero-initialized. 

log_stream_t *stream = new (std::nothrow) log_stream_t();

 

So, I don't think your change will address the issue. The bug may locate at
another place.

 

Regards, Vu

 

> -----Original Message-----

> From: Canh Van Truong <canh.v.tru...@dektech.com.au>

> Sent: Thursday, March 14, 2019 6:49 PM

> To: lennart.l...@ericsson.com; vu.m.ngu...@dektech.com.au

> Cc: opensaf-devel@lists.sourceforge.net; Canh Van Truong

> <canh.v.tru...@dektech.com.au>

> Subject: [PATCH 1/1] log: logd crash due to well known stream has

> numOpeners = 0 [#3018]

> 

> When the stream is created, the numOpeners is not initialized and

> may be started with unexpected value (e.g max value of unsigned int32).

> It is not correct. That may cause when client close the well known stream

> and numOpeners may be 0. The crash happens.

> 

> The "numOpeners" should be initialized with 0.

> ---

>  src/log/logd/lgs_stream.cc | 1 +

>  1 file changed, 1 insertion(+)

> 

> diff --git a/src/log/logd/lgs_stream.cc b/src/log/logd/lgs_stream.cc

> index 28344c8cd..8ad0757b9 100644

> --- a/src/log/logd/lgs_stream.cc

> +++ b/src/log/logd/lgs_stream.cc

> @@ -719,6 +719,7 @@ log_stream_t *log_stream_new(const std::string

> &name, int stream_id) {

>    stream->severityFilter = 0x7f; /* by default all levels are allowed */

>    stream->isRtStream = SA_FALSE;

>    stream->dest_names.clear();

> +  stream->numOpeners = 0;  // Set the number of openers is 0 at creating

> stream

> 

>    /* Initiate local or shared stream file descriptor dependant on shared
or

>     * split file system

> --

> 2.15.1

 


_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to