Closed massemanet closed 5 years ago
Thanks!
Seeing 4 test failures:
$ rebar3 eunit
Failures:
1) pkt_sctp_tests:cookie_echo_chunk/0:100
Failure/Error: {error,
{badmatch,<<21,235,131,195,114,0,0,0>>},
[{pkt_sctp,decode_chunks,2,
[{file,
"/home/msantos/src/erlang/pkt/_build/test/lib/pkt/src/pkt_sctp.erl"},
{line,57}]},
{pkt_sctp,codec,1,
[{file,
"/home/msantos/src/erlang/pkt/_build/test/lib/pkt/src/pkt_sctp.erl"},
{line,39}]},
{pkt_sctp_tests,'-cookie_echo_chunk/0-fun-0-',1,
[{file,
"/home/msantos/src/erlang/pkt/_build/test/lib/pkt/test/pkt_sctp_tests.erl"},
{line,100}]},
{eunit_test,run_testfun,1,
[{file,"eunit_test.erl"},{line,71}]},
{eunit_proc,run_test,1,
[{file,"eunit_proc.erl"},{line,510}]},
{eunit_proc,with_timeout,3,
[{file,"eunit_proc.erl"},{line,335}]},
{eunit_proc,handle_test,2,
[{file,"eunit_proc.erl"},{line,493}]},
{eunit_proc,tests_inorder,3,
[{file,"eunit_proc.erl"},{line,435}]}]}
Output:
2) pkt_sctp_tests:data_chunk/0:139
Failure/Error: {error,
{badmatch,
<<1,34,28,185,0,0,0,0,0,0,0,0,84,101,115,116,32,
48,0,0>>},
[{pkt_sctp,decode_chunks,2,
[{file,
"/home/msantos/src/erlang/pkt/_build/test/lib/pkt/src/pkt_sctp.erl"},
{line,57}]},
{pkt_sctp,codec,1,
[{file,
"/home/msantos/src/erlang/pkt/_build/test/lib/pkt/src/pkt_sctp.erl"},
{line,39}]},
{pkt_sctp_tests,'-data_chunk/0-fun-0-',1,
[{file,
"/home/msantos/src/erlang/pkt/_build/test/lib/pkt/test/pkt_sctp_tests.erl"},
{line,139}]},
{eunit_test,run_testfun,1,
[{file,"eunit_test.erl"},{line,71}]},
{eunit_proc,run_test,1,
[{file,"eunit_proc.erl"},{line,510}]},
{eunit_proc,with_timeout,3,
[{file,"eunit_proc.erl"},{line,335}]},
{eunit_proc,handle_test,2,
[{file,"eunit_proc.erl"},{line,493}]},
{eunit_proc,tests_inorder,3,
[{file,"eunit_proc.erl"},{line,435}]}]}
Output:
3) pkt_sctp_tests:heartbeat_chunk/0:180
Failure/Error: {error,
{badmatch,<<0,1,0,9,2,0,7,214,192,0,0,0>>},
[{pkt_sctp,decode_chunks,2,
[{file,
"/home/msantos/src/erlang/pkt/_build/test/lib/pkt/src/pkt_sctp.erl"},
{line,57}]},
{pkt_sctp,codec,1,
[{file,
"/home/msantos/src/erlang/pkt/_build/test/lib/pkt/src/pkt_sctp.erl"},
{line,39}]},
{pkt_sctp_tests,'-heartbeat_chunk/0-fun-0-',1,
[{file,
"/home/msantos/src/erlang/pkt/_build/test/lib/pkt/test/pkt_sctp_tests.erl"},
{line,180}]},
{eunit_test,run_testfun,1,
[{file,"eunit_test.erl"},{line,71}]},
{eunit_proc,run_test,1,
[{file,"eunit_proc.erl"},{line,510}]},
{eunit_proc,with_timeout,3,
[{file,"eunit_proc.erl"},{line,335}]},
{eunit_proc,handle_test,2,
[{file,"eunit_proc.erl"},{line,493}]},
{eunit_proc,tests_inorder,3,
[{file,"eunit_proc.erl"},{line,435}]}]}
Output:
4) pkt_sctp_tests:heartbeat_ack_chunk/0:198
Failure/Error: {error,
{badmatch,<<0,1,0,9,2,0,7,214,192,0,0,0>>},
[{pkt_sctp,decode_chunks,2,
[{file,
"/home/msantos/src/erlang/pkt/_build/test/lib/pkt/src/pkt_sctp.erl"},
{line,57}]},
{pkt_sctp,codec,1,
[{file,
"/home/msantos/src/erlang/pkt/_build/test/lib/pkt/src/pkt_sctp.erl"},
{line,39}]},
{pkt_sctp_tests,'-heartbeat_ack_chunk/0-fun-0-',1,
[{file,
"/home/msantos/src/erlang/pkt/_build/test/lib/pkt/test/pkt_sctp_tests.erl"},
{line,198}]},
{eunit_test,run_testfun,1,
[{file,"eunit_test.erl"},{line,71}]},
{eunit_proc,run_test,1,
[{file,"eunit_proc.erl"},{line,510}]},
{eunit_proc,with_timeout,3,
[{file,"eunit_proc.erl"},{line,335}]},
{eunit_proc,handle_test,2,
[{file,"eunit_proc.erl"},{line,493}]},
{eunit_proc,tests_inorder,3,
[{file,"eunit_proc.erl"},{line,435}]}]}
Output:
ouch. didn't realize there was a test suite... I'll fix and push
I changed the pad length to be in bytes (because chunk length is in bytes), but forgot to change the match. D'oh
Thank you!
when
decode_chunks
is called with a binary that's longer than 4 bytes, but shorter thanLength
, the match on line 58 will fail.can happen e.g. in truncated files.