[vlc-commits] test: bits: add double escape test
Francois Cartegnie
git at videolan.org
Wed Apr 15 17:56:12 CEST 2020
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Apr 15 17:36:02 2020 +0200| [d4fd13626395bd90226f80de13642cae7c6af7b3] | committer: Francois Cartegnie
test: bits: add double escape test
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d4fd13626395bd90226f80de13642cae7c6af7b3
---
test/src/misc/bits.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/test/src/misc/bits.c b/test/src/misc/bits.c
index 6f021e3b9e..df4e5c4923 100644
--- a/test/src/misc/bits.c
+++ b/test/src/misc/bits.c
@@ -285,6 +285,54 @@ static int test_annexb( const char *psz_tag )
test_assert(bs_remain( &bs ), 0);
test_assert(bs_pos( &bs ), ARRAY_SIZE(annexb) * 8);
+ /* real world vps */
+ const uint8_t vpsnal[] = { 0x40, 0x01, 0x0C, 0x01, 0xFF, 0xFF, 0x01, 0x60,
+ 0x00, 0x00, 0x03, 0x00, 0x40, 0x00, 0x00, 0x03,
+ 0x00, 0x00, 0x03, 0x00, 0x78, 0x10, 0x90, 0x24 };
+ const uint8_t vpsnalunesc[] = {
+ 0x40, 0x01, 0x0C, 0x01, 0xFF, 0xFF, 0x01, 0x60,
+ 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x78, 0x10, 0x90, 0x24 };
+ bs_init( &bs, vpsnal, ARRAY_SIZE(vpsnal) );
+ hxxx_bsfw_ep3b_ctx_init( &bsctx );
+ bs.cb = hxxx_bsfw_ep3b_callbacks;
+ bs.p_priv = &bsctx;
+ test_assert(bs_remain( &bs ), ARRAY_SIZE(vpsnalunesc) * 8);
+ for(size_t i=0; i<ARRAY_SIZE(vpsnalunesc); i++)
+ test_assert(bs_read(&bs, 8), vpsnalunesc[i]);
+
+ /* real world sei, triggered double unescape bug */
+ const uint8_t seinal[] = { 0x4E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xxx_bsfw_ep3b_ctx_init( &bsctx );
+ bs.cb = hxxx_bsfw_ep3b_callbacks;
+ bs.p_priv = &bsctx;
+ test_assert(bs_remain( &bs ), ARRAY_SIZE(seinalunesc) * 8);
+ for(size_t i=0; i<ARRAY_SIZE(seinalunesc); i++)
+ test_assert(bs_read(&bs, 8), seinalunesc[i]);
+
return 0;
}
More information about the vlc-commits
mailing list