bytereader: fix peek value when scanning for 00 00 01 with non-0 offset
authorTim-Philipp Müller <tim@centricular.com>
Tue, 21 Feb 2017 20:23:51 +0000 (20:23 +0000)
committerTim-Philipp Müller <tim@centricular.com>
Wed, 22 Feb 2017 11:07:24 +0000 (11:07 +0000)
commit834fd18dfaa79c99cac460f9597b3bb5f7e240d9
tree184931c71a36cdaae3f0d13080308debd8a9c89a
parenta15f7ad8f86d6331272024530b940577de6c74e3
bytereader: fix peek value when scanning for 00 00 01 with non-0 offset

We would add the offset a second time in _scan_for_start_code()
when we found a result, but it's already been added to the data
pointer at the beginning of _masked_scan_uint32_peek(), so the
peeked value would be wrong if the initial offset was >0, and
we would potentially read memory out-of-bounds.

Add unit test for all of this.

https://bugzilla.gnome.org/show_bug.cgi?id=778365
libs/gst/base/gstbytereader.c
tests/check/libs/bytereader.c