media: Quit parsing stream if doesn't start with SOI
authorMirela Rabulea <mirela.rabulea@nxp.com>
Thu, 11 Mar 2021 00:28:50 +0000 (01:28 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 22 Mar 2021 09:39:30 +0000 (10:39 +0100)
commitccbea178db47bf4a111ee97c0d77678818563a93
treed6862edb6878e7a9e7470d95dfe5be844d6b9c38
parentb8035f7988a82cbbabf1009b9f3234ff2431f8a4
media: Quit parsing stream if doesn't start with SOI

In the case we get an invalid stream, such as from v4l2-compliance
streaming test, jpeg_next_marker will end up parsing the entire
stream. The standard describes the high level syntax of a jpeg
as starting with SOI, ending with EOI, so return error if the very
first 2 bytes are not SOI.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/v4l2-core/v4l2-jpeg.c