Re: [PATCH v2] edid-decode: Avoid division by zero

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/1/19 10:10 AM, Breno Leitao wrote:
> There are some weird monitors that returns invalid data, as zeroed
> Horizontal/Vertical Active/Blanking.

Do you have an EDID that does this? I'd like to add it to the collection
of EDIDs in edid-decode.

Some more nitpicks below:

> 
> This causes edid-decode to crash with a division by zero exception. This simple
> patch avoids so, checking for the divisor before proceeding.
> 
> Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
> ---
>  edid-decode.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/edid-decode.c b/edid-decode.c
> index 7442f8a..b932179 100644
> --- a/edid-decode.c
> +++ b/edid-decode.c
> @@ -1022,6 +1022,16 @@ static int detailed_block(const unsigned char *x, int in_extension)
>  		break;
>  	}
>  
> +	if (!ha || !hbl || !va || !vbl) {
> +		printf("Invalid Detailing Timings:\n"

Detailing -> Detailed

> +		       "Horizontal Active %4d\n"
> +		       "Horizontal Blanking %4d\n"

This can be a bit more concise:

			"Horizontal Active/Blanking: %d/%d\n"

> +		       "Vertical Active %4d\n"
> +		       "Vertical Blanking %4d\n",

Ditto.

> +		       ha, hbl, va, vbl);
> +		return 0;
> +	}
> +
>  	pixclk_khz = (x[0] + (x[1] << 8)) * 10;
>  	refresh = (pixclk_khz * 1000) / ((ha + hbl) * (va + vbl));
>  	printf("Detailed mode: Clock %.3f MHz, %d mm x %d mm\n"
> 

Regards,

	Hans



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux