linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Ratiu <adrian.ratiu@collabora.com>
To: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>,
	linux-media@vger.kernel.org,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>,
	Jacek Anaszewski <jacek.anaszewski@gmail.com>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Rick Chang <rick.chang@mediatek.com>,
	Bin Liu <bin.liu@mediatek.com>,
	Ezequiel Garcia <ezequiel@collabora.com>,
	Mirela Rabulea <mirela.rabulea@nxp.com>,
	kernel@pengutronix.de
Subject: Re: [PATCH 0/5] v4l2 JPEG helpers and CODA960 JPEG decoder
Date: Wed, 18 Mar 2020 14:42:51 +0200	[thread overview]
Message-ID: <87pnd9hm0k.fsf@collabora.com> (raw)
In-Reply-To: <a15c3694-021f-c6af-7d09-dfca14c0ea7b@gmail.com>

Hi Andrzej,

On Wed, 18 Mar 2020, Andrzej Pietrasiewicz 
<andrzejtp2010@gmail.com> wrote:
> Hi Adrian, 
> 
> W dniu 18.03.2020 o 11:41, Adrian Ratiu pisze: 
>  > Hi Philipp, 
>  > 
>  > Further testing revealed the decoder rejects jpegs with 
>  > optimized huffman tables, but the following decoder patch 
>  > makes them work. 
>  > 
>  > Feel free to include these changes in your next version. 
>  >  
>  > Adrian 
>  >  
>  > drivers/media/platform/coda/coda-jpeg.c | 10 +++++----- 1 
>  > file changed, 5 insertions(+), 5 deletions(-)>> 
>  > 
>  > diff --git a/drivers/media/platform/coda/coda-jpeg.c 
>  > b/drivers/media/platform 
> <snip> 
> 
>  > 		} -		if (huffman_tables[i].length != 
>  > ((i & 2) ? 178 : 28)) { +		if 
>  > (huffman_tables[i].length < 17) { v4l2_err(&dev->v4l2_dev, 
>  > "invalid Huffman table %d length: %zu\n", i, 
>  > huffman_tables[i].length); 
> 
> Shouldn't you also be checking the upper bound on the table 
> length, to ensure that you won't exceed the memcpy() 
> destination's capacity below?

Good point, it's always good to have an upper bound sanity check 
test, even though in practice the optimized tables are smaller 
than the std ones by definition, there are never enough checks 
against bugs :)

Thanks,
Adrian

>
> <snip>
>
>  > -	memcpy(huff_tab->dc_values[0], huffman_tables[0].start + 16, 12);
>  > +	memcpy(huff_tab->dc_values[0], huffman_tables[0].start + 16, 
> huffman_tables[0].length - 16);
>
>
> Andrzej

      reply	other threads:[~2020-03-18 12:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-13 15:05 [PATCH 0/5] v4l2 JPEG helpers and CODA960 JPEG decoder Philipp Zabel
2019-11-13 15:05 ` [PATCH 1/5] media: add v4l2 JPEG helpers Philipp Zabel
2019-11-25 11:36   ` [EXT] " Mirela Rabulea
2019-11-25 16:36     ` Philipp Zabel
2019-11-26  9:07       ` Mirela Rabulea
2019-11-13 15:05 ` [PATCH 2/5] media: coda: jpeg: add CODA960 JPEG decoder support Philipp Zabel
2020-03-06 20:31   ` Tim Harvey
2020-03-06 21:01     ` Adrian Ratiu
2020-03-06 21:57       ` Tim Harvey
2020-03-07 12:14         ` Ezequiel Garcia
2020-03-11 17:06           ` Adrian Ratiu
2019-11-13 15:05 ` [PATCH 3/5] media: rcar_jpu: use V4L2 JPEG helpers Philipp Zabel
2019-11-13 15:05 ` [PATCH 4/5] media: s5p-jpeg: use v4l2 " Philipp Zabel
2019-11-13 15:05 ` [PATCH 5/5] media: mtk-jpeg: use V4L2 " Philipp Zabel
2019-11-13 19:42 ` [PATCH 0/5] v4l2 JPEG helpers and CODA960 JPEG decoder Ezequiel Garcia
2019-11-13 20:36   ` Jacek Anaszewski
2019-11-13 21:25     ` Nicolas Dufresne
2019-11-14 10:00   ` Philipp Zabel
2019-11-25 11:36 ` [EXT] " Mirela Rabulea
2019-12-04 10:30 ` Adrian Ratiu
2019-12-13  9:18 ` Hans Verkuil
2020-03-18 10:41 ` Adrian Ratiu
2020-03-18 12:15   ` Andrzej Pietrasiewicz
2020-03-18 12:42     ` Adrian Ratiu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pnd9hm0k.fsf@collabora.com \
    --to=adrian.ratiu@collabora.com \
    --cc=andrzejtp2010@gmail.com \
    --cc=bin.liu@mediatek.com \
    --cc=ezequiel@collabora.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jacek.anaszewski@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-media@vger.kernel.org \
    --cc=mikhail.ulyanov@cogentembedded.com \
    --cc=mirela.rabulea@nxp.com \
    --cc=p.zabel@pengutronix.de \
    --cc=rick.chang@mediatek.com \
    --cc=s.nawrocki@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).