diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2014-10-08 20:09:27 +0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-10-28 20:41:07 +0300 |
commit | edc16cb1159c03864c74fd0411ec5d0bcce845be (patch) | |
tree | 155809aa32a8723a91928e709f174162ab3f31c9 /drivers/media/platform/coda/coda-bit.c | |
parent | d4bb75f6eee2f9cd7dc0787e3a8fb6bb3e430802 (diff) | |
download | linux-edc16cb1159c03864c74fd0411ec5d0bcce845be.tar.xz |
[media] coda: drop JPEG buffers not framed by SOI and EOI markers
This patch adds a quick check for valid JPEG frames before feeding them into
the bitstream buffer: Frames that do not begin with the JPEG start of image
marker and end with the end of image marker are dropped.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform/coda/coda-bit.c')
-rw-r--r-- | drivers/media/platform/coda/coda-bit.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c index 0c67cfd23c16..b4029ae293d3 100644 --- a/drivers/media/platform/coda/coda-bit.c +++ b/drivers/media/platform/coda/coda-bit.c @@ -231,6 +231,16 @@ void coda_fill_bitstream(struct coda_ctx *ctx) src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); + /* Drop frames that do not start/end with a SOI/EOI markers */ + if (ctx->codec->src_fourcc == V4L2_PIX_FMT_JPEG && + !coda_jpeg_check_buffer(ctx, src_buf)) { + v4l2_err(&ctx->dev->v4l2_dev, + "dropping invalid JPEG frame\n"); + src_buf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); + v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_ERROR); + continue; + } + /* Buffer start position */ start = ctx->bitstream_fifo.kfifo.in & ctx->bitstream_fifo.kfifo.mask; |