wavpackparse: Fix potential integer overflow on ID_ODD_SIZE blocks

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6498>
This commit is contained in:
Sebastian Dröge 2024-04-01 14:36:19 +03:00 committed by GStreamer Marge Bot
parent 6402978a48
commit eefb7c1638

View file

@ -322,8 +322,11 @@ gst_wavpack_parse_frame_metadata (GstWavpackParse * parse, GstBuffer * buf,
size <<= 8;
size += c;
size <<= 1;
if (id & ID_ODD_SIZE)
if (id & ID_ODD_SIZE) {
if (size == 0)
goto read_failed;
size--;
}
CHECK (gst_byte_reader_get_data (&br, size + (size & 1), &data));
gst_byte_reader_init (&mbr, data, size);