Fix bug in argument checking in binary:matches/2
Mike Sassak <[email protected]>
| Newsgroups | gmane.comp.lang.erlang.patches |
|---|---|
| Message-ID | <CAN3v6_7ro00nZSN5cOXjNL+9RUZA4GzXwnh0n44vztzCnkFTmw@mail.gmail.com> |
Hi erlang-patches,
Including an empty binary as one of multiple patterns to binary:matches/2
crashes BEAM:
binary:matches(<<"foo">>, [<<>>, <<"f">>]). % -> Crash
Passing just an empty binary, or a list containing only the empty binary
throws a badarg as expected:
binary:matches(<<"foo">>, <<>>) % -> badarg
binary:matches(<<"foo">>, [<<>>]) % -> badarg
My patch ensures all patterns passed to binary:matches/2 are checked for
validity and throws badarg if one is not valid.
You can fetch the patch with:
git fetch git://github.com/msassak/otp.git empty-pattern-badarg
And check out diff views here:
https://github.com/msassak/otp/compare/erlang:maint...empty-pattern-badarg
https://github.com/msassak/otp/compare/erlang:maint...empty-pattern-badarg.patch
Mike
_______________________________________________
erlang-patches mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-patches