Is XMP chunk data zero terminated?

11 views
Skip to first unread message

Dmitry Baryshev

unread,
Jul 28, 2021, 8:53:10 AMJul 28
to WebP Discussion
Hi!

I can fetch the embedded XMP data with

WebPDemuxGetChunk(webp_demux, "XMP ", 1, &chunk_iterator);

Can I assume chunk_iterator.chunk.bytes points to a zero-terminated string in this particular use-case?

Thanks!

Yannis Guyon

unread,
Jul 28, 2021, 9:26:39 AMJul 28
to WebP Discussion, Dmitry Baryshev
I do not think there is any guarantee of that on the WebP format side. Does the ISO 16684-1:2012 standard states that a valid XMP chunk is zero-terminated? Even so, libwebp does not check the content of the metadata chunks at encoding nor at decoding, so a "bad" XMP payload would not generate a WebPDemuxGetChunk() error.
I would suggest relying only on chunk_iterator.chunk.size to know the length of the EXIF/XMP chunks.


Reply all
Reply to author
Forward
0 new messages