diff --git a/contrib/libtests/pngvalid.c b/contrib/libtests/pngvalid.c index c2f8bde39..b99cecd4c 100644 --- a/contrib/libtests/pngvalid.c +++ b/contrib/libtests/pngvalid.c @@ -285,16 +285,47 @@ randomize(void *pv, size_t size) make_random_bytes(random_seed, pv, size); } -#define RANDOMIZE(this) randomize(&(this), sizeof (this)) +#define R8(this) randomize(&(this), sizeof (this)) + +static void r16(png_uint_16p p16, size_t count) +{ + size_t i; + + for (i=0; i>= 16; data.red_coefficient = (1 - total) * (ru & 0xffff) / 65535.; @@ -7843,7 +7873,7 @@ image_transform_png_set_background_set(const image_transform *this, * so we need to know what that is! The background colour is stored in the * transform_display. */ - RANDOMIZE(random_bytes); + R8(random_bytes); /* Read the random value, for colour type 3 the background colour is actually * expressed as a 24bit rgb, not an index. @@ -7871,7 +7901,7 @@ image_transform_png_set_background_set(const image_transform *this, /* Extract the background colour from this image_pixel, but make sure the * unused fields of 'back' are garbage. */ - RANDOMIZE(back); + R8(back); if (colour_type & PNG_COLOR_MASK_COLOR) { @@ -8177,7 +8207,7 @@ image_transform_png_set_filler_set(const image_transform *this, * filler. The 'filler' value has all 32 bits set, but only bit_depth * will be used. At this point we don't know bit_depth. */ - RANDOMIZE(data.filler); + R32(data.filler); data.flags = random_choice(); png_set_filler(pp, data.filler, data.flags); @@ -8250,7 +8280,7 @@ image_transform_png_set_add_alpha_set(const image_transform *this, * filler. The 'filler' value has all 32 bits set, but only bit_depth * will be used. At this point we don't know bit_depth. */ - RANDOMIZE(data.filler); + R32(data.filler); data.flags = random_choice(); png_set_add_alpha(pp, data.filler, data.flags);