[Spice-devel] [spice-common 5/8] coverity: avoid division or modulo by zero

Victor Toso lists at victortoso.com
Mon Apr 4 08:55:38 UTC 2016


Hi,

On Mon, Apr 04, 2016 at 10:03:36AM +0200, Fabiano FidĂȘncio wrote:
> ---
>  common/lines.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/lines.c b/common/lines.c
> index 10ca318..e5097c4 100644
> --- a/common/lines.c
> +++ b/common/lines.c
> @@ -412,7 +412,7 @@ miStepDash (int dist,           /* distance to step */
>      totallen = 0;
>      for (i = 0; i < numInDashList; i++)
>          totallen += pDash[i];
> -    if (totallen <= dist)
> +    if (totallen > 0 && totallen <= dist)
>          dist = dist % totallen;

Acked-by: Victor Toso <victortoso at redhat.com>

>      while (dist >= pDash[dashIndex]) {
>          dist -= pDash[dashIndex];
> -- 
> 2.7.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list