[zeromq-dev] OpenPGM & segfault - assertion failed

Martin Sustrik sustrik at 250bpm.com
Thu May 13 12:44:46 CEST 2010


Steven McCoy wrote:
> This patch, released under MIT license, shows memory corruption a bit 
> earlier,
> 
> --- a/src/pgm_socket.cpp
> +++ b/src/pgm_socket.cpp
> @@ -489,6 +489,10 @@ ssize_t zmq::pgm_socket_t::receive (void 
> **raw_data_, const pgm_tsi_t **tsi_)
>  
>          zmq_assert (status == PGM_IO_STATUS_NORMAL);
>      }
> +    else
> +    {
> +        zmq_assert (pgm_msgv_processed <= pgm_msgv_len);
> +    }
>  
>      zmq_assert (nbytes_rec > 0);
>  
> @@ -507,6 +511,7 @@ ssize_t zmq::pgm_socket_t::receive (void 
> **raw_data_, const pgm_tsi_t **tsi_)
>  
>      //  Move the the next pgm_msgv_t structure.
>      pgm_msgv_processed++;
> +    zmq_assert (pgm_msgv_processed <= pgm_msgv_len);
>      nbytes_processed +=raw_data_len;
>  
>      return raw_data_len;

Ok. Committed to the trunk.

Thanks!
Martin



More information about the zeromq-dev mailing list