* [PATCH] media: v4l2-jpeg: ignore the unknown APP14 marker
@ 2022-12-16 9:08 Ming Qian
2023-02-18 21:50 ` mirela.rabulea
2023-02-18 21:51 ` mirela.rabulea
0 siblings, 2 replies; 3+ messages in thread
From: Ming Qian @ 2022-12-16 9:08 UTC (permalink / raw)
To: mchehab, mirela.rabulea, hverkuil-cisco
Cc: shawnguo, s.hauer, kernel, festevam, xiahong.bao, linux-imx,
linux-media, linux-kernel, devicetree, linux-arm-kernel
The legal identifier of APP14 is "Adobe\0",
but sometimes it may be
"This is an unknown APP marker . Compliant decoders must ignore it."
In this case, just ignore it.
It won't affect the decode result.
Fixes: b8035f7988a8 ("media: Add parsing for APP14 data segment in jpeg helpers")
Signed-off-by: Ming Qian <ming.qian@nxp.com>
---
drivers/media/v4l2-core/v4l2-jpeg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/v4l2-core/v4l2-jpeg.c b/drivers/media/v4l2-core/v4l2-jpeg.c
index 75c2af763d55..94435a7b6816 100644
--- a/drivers/media/v4l2-core/v4l2-jpeg.c
+++ b/drivers/media/v4l2-core/v4l2-jpeg.c
@@ -460,7 +460,7 @@ static int jpeg_parse_app14_data(struct jpeg_stream *stream,
/* Check for "Adobe\0" in Ap1..6 */
if (stream->curr + 6 > stream->end ||
strncmp(stream->curr, "Adobe\0", 6))
- return -EINVAL;
+ return jpeg_skip(stream, lp - 2);
/* get to Ap12 */
ret = jpeg_skip(stream, 11);
--
2.38.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] media: v4l2-jpeg: ignore the unknown APP14 marker
2022-12-16 9:08 [PATCH] media: v4l2-jpeg: ignore the unknown APP14 marker Ming Qian
@ 2023-02-18 21:50 ` mirela.rabulea
2023-02-18 21:51 ` mirela.rabulea
1 sibling, 0 replies; 3+ messages in thread
From: mirela.rabulea @ 2023-02-18 21:50 UTC (permalink / raw)
To: Ming Qian, mchehab, hverkuil-cisco
Cc: shawnguo, s.hauer, kernel, festevam, xiahong.bao, linux-imx,
linux-media, linux-kernel, devicetree, linux-arm-kernel
Hi,
On 16.12.2022 11:08, Ming Qian wrote:
> The legal identifier of APP14 is "Adobe\0",
> but sometimes it may be
> "This is an unknown APP marker . Compliant decoders must ignore it."
> In this case, just ignore it.
> It won't affect the decode result.
I'm not sure, based on the specs only, what the decoders should do if
the segment does not follow the definition.
I only found this in T.81:
"The APPn (Application) segments are reserved for application use. Since
these segments may be defined differently for
different applications, they should be removed when the data are
exchanged between application environments."
And in T.872, the mention about "Adobe\0".
But, I agree ignoring it is more robust, and I confirm imx-jpeg can
decode such jpegs.
Reviewed-by: Mirela Rabulea <mirela.rabulea@nxp.com>
>
> Fixes: b8035f7988a8 ("media: Add parsing for APP14 data segment in jpeg helpers")
> Signed-off-by: Ming Qian <ming.qian@nxp.com>
> ---
> drivers/media/v4l2-core/v4l2-jpeg.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/v4l2-core/v4l2-jpeg.c b/drivers/media/v4l2-core/v4l2-jpeg.c
> index 75c2af763d55..94435a7b6816 100644
> --- a/drivers/media/v4l2-core/v4l2-jpeg.c
> +++ b/drivers/media/v4l2-core/v4l2-jpeg.c
> @@ -460,7 +460,7 @@ static int jpeg_parse_app14_data(struct jpeg_stream *stream,
> /* Check for "Adobe\0" in Ap1..6 */
> if (stream->curr + 6 > stream->end ||
> strncmp(stream->curr, "Adobe\0", 6))
> - return -EINVAL;
> + return jpeg_skip(stream, lp - 2);
>
> /* get to Ap12 */
> ret = jpeg_skip(stream, 11);
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] media: v4l2-jpeg: ignore the unknown APP14 marker
2022-12-16 9:08 [PATCH] media: v4l2-jpeg: ignore the unknown APP14 marker Ming Qian
2023-02-18 21:50 ` mirela.rabulea
@ 2023-02-18 21:51 ` mirela.rabulea
1 sibling, 0 replies; 3+ messages in thread
From: mirela.rabulea @ 2023-02-18 21:51 UTC (permalink / raw)
To: Ming Qian, mchehab, hverkuil-cisco
Cc: shawnguo, s.hauer, kernel, festevam, xiahong.bao, linux-imx,
linux-media, linux-kernel, devicetree, linux-arm-kernel
On 16.12.2022 11:08, Ming Qian wrote:
> The legal identifier of APP14 is "Adobe\0",
> but sometimes it may be
> "This is an unknown APP marker . Compliant decoders must ignore it."
> In this case, just ignore it.
> It won't affect the decode result.
>
> Fixes: b8035f7988a8 ("media: Add parsing for APP14 data segment in jpeg helpers")
> Signed-off-by: Ming Qian <ming.qian@nxp.com>
Thanks,
Reviewed-by: Mirela Rabulea <mirela.rabulea@nxp.com>
> ---
> drivers/media/v4l2-core/v4l2-jpeg.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/v4l2-core/v4l2-jpeg.c b/drivers/media/v4l2-core/v4l2-jpeg.c
> index 75c2af763d55..94435a7b6816 100644
> --- a/drivers/media/v4l2-core/v4l2-jpeg.c
> +++ b/drivers/media/v4l2-core/v4l2-jpeg.c
> @@ -460,7 +460,7 @@ static int jpeg_parse_app14_data(struct jpeg_stream *stream,
> /* Check for "Adobe\0" in Ap1..6 */
> if (stream->curr + 6 > stream->end ||
> strncmp(stream->curr, "Adobe\0", 6))
> - return -EINVAL;
> + return jpeg_skip(stream, lp - 2);
>
> /* get to Ap12 */
> ret = jpeg_skip(stream, 11);
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-02-18 22:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-16 9:08 [PATCH] media: v4l2-jpeg: ignore the unknown APP14 marker Ming Qian
2023-02-18 21:50 ` mirela.rabulea
2023-02-18 21:51 ` mirela.rabulea
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox