typefind: Fix handling of ID_ODD_SIZE in WavPack typefinder

Chunks are always starting on an even position and this flag only
specifies that the last byte of the chunk is not valid.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3569

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6944>
This commit is contained in:
Sebastian Dröge 2024-05-28 16:04:37 +03:00 committed by Backport Bot
parent b77de8f6f2
commit 3d9fd9926c

View file

@ -2094,12 +2094,8 @@ wavpack_type_find (GstTypeFind * tf, gpointer unused)
sublen += 1 + 1; /* id + length */ sublen += 1 + 1; /* id + length */
} }
// ID_ODD_SIZE // ID_ODD_SIZE only affects how much of the chunk is valid. The next one
if (data[0] & 0x40) { // still starts at an even position, so it's ignored here.
if (sublen == 0)
return;
sublen -= 1;
}
if (offset + sublen > 8 + blocksize) { if (offset + sublen > 8 + blocksize) {
GST_LOG ("chunk length too big (%u > %" G_GUINT64_FORMAT ")", sublen, GST_LOG ("chunk length too big (%u > %" G_GUINT64_FORMAT ")", sublen,