[CRIU] [PATCH] Fixed OVERFLOW_BEFORE_WIDEN issue introduced by remote images code.

Andrei Vagin avagin at virtuozzo.com
Thu Mar 23 21:57:00 PDT 2017


On Sun, Mar 19, 2017 at 09:55:23PM +0000, rodrigo-bruno wrote:
> Signed-off-by: rodrigo-bruno <rbruno at gsd.inesc-id.pt>
> ---
>  criu/img-remote-proto.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/criu/img-remote-proto.c b/criu/img-remote-proto.c
> index 3751b6f..51584bb 100644
> --- a/criu/img-remote-proto.c
> +++ b/criu/img-remote-proto.c
> @@ -743,7 +743,7 @@ int64_t send_image(int fd, struct rimage *rimg, int flags, bool close_fd)
>  			} else if (rimg->curr_sent_bytes == rimg->curr_sent_buf->nbytes) {
>  				if (close_fd)
>  					close(fd);
> -			       return nblocks*BUF_SIZE + rimg->curr_sent_buf->nbytes;
> +			       return ((int64_t)nblocks*BUF_SIZE) + rimg->curr_sent_buf->nbytes;

I'm not sure that I understand the logic of this function. For me it
looks incorrect.

The first thing is that I don't understand why you need to spit data to
blocks.

The second thing is that I think the following line is incorrect:

min(BUF_SIZE, rimg->curr_sent_buf->nbytes) - rimg->curr_sent_bytes,

nbytes is a constant in this function and it should be incorrect if
nbytes is greater than BUF_SIZE and it isn't multiple to BUF_SIZE.

>  			}
>  		} else if (errno == EPIPE || errno == ECONNRESET) {
>  			pr_warn("Connection for %s:%s was closed early than expected\n",
> -- 
> 2.1.4
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list