lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <eb68242108a6ad7ad604616fb78bea2fb09dffc2.camel@pengutronix.de>
Date:   Mon, 04 Jan 2021 18:00:55 +0100
From:   Philipp Zabel <p.zabel@...gutronix.de>
To:     "Mirela Rabulea (OSS)" <mirela.rabulea@....nxp.com>,
        mchehab@...nel.org, hverkuil-cisco@...all.nl, shawnguo@...nel.org,
        robh+dt@...nel.org
Cc:     paul.kocialkowski@...tlin.com, linux-media@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-imx@....com,
        s.hauer@...gutronix.de, aisheng.dong@....com,
        daniel.baluta@....com, robert.chiras@....com,
        laurentiu.palcu@....com, mark.rutland@....com,
        devicetree@...r.kernel.org, ezequiel@...labora.com,
        laurent.pinchart+renesas@...asonboard.com,
        niklas.soderlund+renesas@...natech.se,
        dafna.hirschfeld@...labora.com,
        Mirela Rabulea <mirela.rabulea@....com>
Subject: Re: [PATCH v6 8/9] media: Avoid parsing quantization and huffman
 tables

On Tue, 2020-12-15 at 13:18 +0200, Mirela Rabulea (OSS) wrote:
> From: Mirela Rabulea <mirela.rabulea@....com>
> 
> These are optional in struct v4l2_jpeg_header, so skip DHT/DQT segment
> parsing if huffman_tables/quantization_tables were not requested by user,
> to save time.
> However, do count them (num_dht/num_dqt).
> 
> Signed-off-by: Mirela Rabulea <mirela.rabulea@....com>
> ---
> Changes in v6:
>   Call jpeg_skip_segment() instead of jpeg_parse_quantization_table()/jpeg_parse_huffman_tables(),
>   when quantization/huffman tables are not requested by user.
>   Remove the NULL pointer check in the lower-level function.
>   Thanks Philipp & Hans for feedback
> 
>  drivers/media/v4l2-core/v4l2-jpeg.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-jpeg.c b/drivers/media/v4l2-core/v4l2-jpeg.c
> index dc9def4c2648..f3d03d39defb 100644
> --- a/drivers/media/v4l2-core/v4l2-jpeg.c
> +++ b/drivers/media/v4l2-core/v4l2-jpeg.c
> @@ -537,6 +537,10 @@ int v4l2_jpeg_parse_header(void *buf, size_t len, struct v4l2_jpeg_header *out)
>  					&out->dht[out->num_dht++ % 4]);
>  			if (ret < 0)
>  				return ret;
> +			if (!out->huffman_tables) {
> +				ret = jpeg_skip_segment(&stream);
> +				break;
> +			}
>  			ret = jpeg_parse_huffman_tables(&stream,
>  							out->huffman_tables);
>  			break;
> @@ -545,6 +549,10 @@ int v4l2_jpeg_parse_header(void *buf, size_t len, struct v4l2_jpeg_header *out)
>  					&out->dqt[out->num_dqt++ % 4]);
>  			if (ret < 0)
>  				return ret;
> +			if (!out->quantization_tables) {
> +				ret = jpeg_skip_segment(&stream);
> +				break;
> +			}
>  			ret = jpeg_parse_quantization_tables(&stream,
>  					out->frame.precision,
>  					out->quantization_tables);

Reviewed-by: Philipp Zabel <p.zabel@...gutronix.de>

regards
Philipp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ