[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH V4 3/5] fuzz: Fuzzing functions for qcow2 images
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH V4 3/5] fuzz: Fuzzing functions for qcow2 images |
Date: |
Fri, 1 Aug 2014 06:55:18 +0100 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Mon, Jul 21, 2014 at 02:18:10PM +0400, Maria Kustova wrote:
> +def random_from_intervals(intervals):
> + """Select a random integer number from the list of specified intervals
> +
> + Each interval is a tuple of lower and upper limits of the interval. The
> + limits are included. Intervals in a list should not overlap.
> + """
> + total = reduce(lambda x, y: x + y[1] - y[0] + 1, intervals, 0)
> + r = random.randint(0, total-1) + intervals[0][0]
> + temp = zip(intervals, intervals[1:])
> + for x in temp:
> + r = r + (r > x[0][1])*(x[1][0] - x[0][1] - 1)
Please use space around arithmetic operators:
r = r + (r > x[0][1]) * (x[1][0] - x[0][1] - 1)
pgpBIooqspfDs.pgp
Description: PGP signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [PATCH V4 3/5] fuzz: Fuzzing functions for qcow2 images,
Stefan Hajnoczi <=