matroskademux: Fix extraction of multichannel WavPack

The old code had a couple of issues that all lead to potential memory
safety bugs.

  - Use a constant for the Wavpack4Header size instead of using sizeof.
    It's written out into the data and not from the struct and who knows
    what special alignment/padding requirements some C compilers have.
  - gst_buffer_set_size() does not realloc the buffer when setting a
    bigger size than allocated, it only allows growing up to the maximum
    allocated size. Instead use a GstAdapter to collect all the blocks
    and take out everything at once in the end.
  - Check that enough data is actually available in the input and
    otherwise handle it an error in all cases instead of silently
    ignoring it.

Among other things this fixes out of bounds writes because the code
assumed gst_buffer_set_size() can grow the buffer and simply wrote after
the end of the buffer.

Thanks to Natalie Silvanovich for reporting.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/859

Part-of: <gstreamer/gst-plugins-good!903>
32 jobs for !903 with backport-mr-902-into-1.18-matroskademux-fixes in 43 minutes and 37 seconds (queued for 3 seconds)
detached
Status Job ID Name Coverage
  Build Docker
passed #7995394
alpine amd64 manifest builder docker

00:00:30

passed #7995393
android docker

00:00:30

passed #7995392
cerbero fedora amd64 docker

00:00:30

passed #7995391
fedora amd64 docker

00:00:28

passed #7995395
gst-indent amd64 docker

00:00:29

 
  Preparation
passed #7995397
gst indent

00:00:32

passed #7995396
manifest

00:00:15

 
  Build
passed #7995406
gstreamer
build cerbero cross-android universal

00:11:49

passed #7995410
gst-ios-14.3
build cerbero cross-ios universal

00:22:23

passed #7995407
gstreamer
build cerbero cross win32

00:07:14

passed #7995408
gstreamer
build cerbero cross win64

00:03:52

passed #7995405
gstreamer
build cerbero fedora x86_64

00:05:37

passed #7995409
gst-macos-11.1
build cerbero macos x86_64

00:14:05

passed #7995401
build clang fedora x86_64

00:04:48

manual #7995404
docker windows 1809 allowed to fail manual
build msys2
passed #7995398
build nodebug fedora x86_64

00:04:40

passed #7995399
build static fedora x86_64

00:05:07

passed #7995400
build static nodebug fedora x86_64

00:04:33

passed #7995402
docker windows 1809
build vs2017 amd64

00:09:56

passed #7995403
docker windows 1809
build vs2017 x86

00:09:35

 
  Test
passed #7999026
gstreamer
check fedora

00:04:48

passed #7995412
gstreamer
integration testsuites fedora 1/4

00:12:58

passed #7995413
gstreamer
integration testsuites fedora 2/4

00:15:04

passed #7995414
gstreamer
integration testsuites fedora 3/4

00:13:29

passed #7995415
gstreamer
integration testsuites fedora 4/4

00:18:33

passed #7995417
gstreamer
valgrind bad

00:05:50

passed #7995418
gstreamer
valgrind ges

00:06:01

passed #7995416
gstreamer
valgrind good

00:09:32

failed #7995411
gstreamer
check fedora

00:06:07

 
  Integrate
passed #7995419
cross-android universal examples

00:06:46

passed #7995421
gst-ios-14.3
cross-ios universal examples

00:05:20

passed #7995420
documentation

00:12:38