wavparse: Fix crash that occurs in push mode when header chunks are corrupted
authorDevin Anderson <danderson@microsoft.com>
Thu, 13 Oct 2022 00:20:45 +0000 (00:20 +0000)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 13 Oct 2022 08:56:49 +0000 (08:56 +0000)
commit4e03c5f88548295589cb358fd047838ef5d5c6ec
treef93a7a06362152439772ca024dd2518e0719aad7
parent11436be2682631fb21f412f79e5f6daa4631d13e
wavparse: Fix crash that occurs in push mode when header chunks are corrupted
in certain ways.

In the case that a test is provided for, the size of the `fmt ` chunk is
changed from 16 bytes to 18 bytes (bytes 17 - 20 below):
```
$ hexdump -C corruptheadertestsrc.wav
00000000  52 49 46 46 e4 fd 00 00  57 41 56 45 66 6d 74 20  |RIFF....WAVEfmt |
00000010  12 00 00 00 01 00 01 00  80 3e 00 00 00 7d 00 00  |.........>...}..|
00000020  02 00 10 00 64 61 74 61                           |....data|
00000028
```

(Note that the original file is much larger.  This was the smallest sub-file
I could find that would generate the crash.)

Note that, while the same issue doesn't cause a crash in pull mode, there's a
different issue in that the file is processed successfully as if it was a .wav
file with zero samples.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3173>
subprojects/gst-plugins-good/gst/wavparse/gstwavparse.c
subprojects/gst-plugins-good/tests/check/elements/wavparse.c
subprojects/gst-plugins-good/tests/files/corruptheadertestsrc.wav [new file with mode: 0755]